我遇到了SOAP响应问题,我希望有人可以帮助我。
当SOAP :: Lite模块对SOAP-Response进行反序列化时,我认为出了问题。在SOAP-Response中有一些“普通”节点和引用的节点。但不是正确反序列化的。SOAP-响应:
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:SOAP_GetFirmenlisteResponse xmlns:ns1="http://www.4d.com/namespace/default">
<ERRORNUM xsi:type="xsd:int">0</ERRORNUM>
<ERRORTEXT xsi:type="xsd:string">
</ERRORTEXT>
<LISTE_KDLF_NR_ALS_IDS href="#ref-1"/> <LISTE_SUCHNAMEN href="#ref-2"/> <LISTE_LFD_NR href="#ref-3"/> <LISTE_TIMESTAMP_GEAENDERT href="#ref-4"/> <LISTE_TIMESTAMP_ERZEUGT href="#ref-5"/>
</ns1:SOAP_GetFirmenlisteResponse>
<SOAP-ENC:Array id="ref-1" SOAP-ENC:arrayType="xsd:string[4]">
<item1>19288</item1>
<item2>19289</item2>
<item3>60107</item3>
<item4>71897</item4>
</SOAP-ENC:Array>
<SOAP-ENC:Array id="ref-2" SOAP-ENC:arrayType="xsd:string[4]">
<item1>Blabla1</item1>
<item2>Blabla2</item2>
<item3>Bla München</item3>
<item4>Blaürm BÄR</item4>
</SOAP-ENC:Array>
<SOAP-ENC:Array id="ref-3" SOAP-ENC:arrayType="xsd:int[4]">
<item1>-8423</item1>
<item2>-8426</item2>
<item3>-8425</item3>
<item4>-8428</item4>
</SOAP-ENC:Array>
<SOAP-ENC:Array id="ref-4" SOAP-ENC:arrayType="xsd:string[4]">
<item1>2015-11-23T09:32:23</item1>
<item2>2015-11-26T14:55:52</item2>
<item3>2015-11-26T08:07:26</item3>
<item4>2015-11-27T09:26:25</item4>
</SOAP-ENC:Array>
<SOAP-ENC:Array id="ref-5" SOAP-ENC:arrayType="xsd:string[4]">
<item1>2015-11-23T09:30:54</item1>
<item2>2015-11-26T14:52:06</item2>
<item3>2015-11-25T10:33:27</item3>
<item4>2015-11-27T09:24:05</item4>
</SOAP-ENC:Array>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
转储结果哈希:
$VAR1 = {
'ARRAY(0x2c16e08)' => undef,
'0' => '',
'ARRAY(0x2f42168)' => [
'Blabla1',
'Blabla2',
"Bla M\x{fc}nchen",
"Bla\x{fc}rm B\x{c4}R"
],
'ARRAY(0x2f39680)' => [
'2015-11-23T09:32:23',
'2015-11-26T14:55:52',
'2015-11-26T08:07:26',
'2015-11-27T09:26:25'
]
};
Perl代码:
#!/usr/bin/perl
use Data::Dumper;
use SOAP::Lite +trace => [ transport => \&log_message ];
sub log_message {
my ($in) = @_;
my ($cont) = $in->content;
$cont =~ s/></>\n</g;
print "\n-------------------------------------------------\n";
print $cont;
print "\n-------------------------------------------------\n";
}
my $soap = SOAP::Lite->service('http://192.168.0.13:8181/4dwsdl');
$soap->envprefix('SOAP-ENV');
$soap->encprefix('SOAP-ENC');
$soap->soapversion('1.1');
my %result = $soap->SOAP_GetFirmenliste(
'00',
'SOAPTest',
'soaptest',
'0000-00-00',
'2015-10-01'
);
print Dumper(\%result);
exit 0;
答案 0 :(得分:0)
我很确定你的问题是:
my %result = $soap->SOAP_GetFirmenliste(
因为print
的结果表明由此返回的第一个元素是数组引用(它被转换为字符串)。
我担心我无法直接告诉它将要返回的内容,我建议您尝试:
my $result = $soap -> SOAP_GetFirmenliste(
然后print Dumper $result
这应该向您展示您正在获得的数据结构 - 它不会成为哈希。