简体   繁体   中英

XML::Compile::SOAP - convert response into hash

I'm quite new to SOAP and XML::Compile and most of the examples that I could google end with the SOAP call without much explanation on how to process the response.

Is there an easy way to convert SOAP response to hash ?

here is my code

....

my ($response, $trace) = $call->($request);
my $content=$trace->response->decoded_content();
my $out=XML::Hash->new()->fromXMLStringtoHash($content)

but I'm getting the following error:

junk after document element at line 4, column 0, byte 11177 at /usr/lib/perl5

Looking at what was returned from the server:

< soap:Envelope .....

ba8

...< /soap:Envelope>

0

I'm not sure how the 'ba8' get into the response as once you remove it looks like a complete and valid response.

The SOAP response should be a hash. trace is an object that lets you get the HTTP request and/or response, but you should not need to look at that except to debug.

use Data::Dumper;

...
print Dumper $response;

事实证明,问题出在Net :: HTTP中的已知错误-我将它与LWP :: UserAgent一起升级到最新版本后,一切正常,以防万一。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM