My aim is to redirect the XML Response into another file.
But i am not able to redirect the XML response into response.xml file.
I have written below script.
Expand|Select|Wrap|Line Numbers
- use Data::Dumper;
- $Data::Dumper::Terse = 1;
- $Data::Dumper::Indent = 1;
- use SOAP::Lite +trace => 'debug';
- @ARGV = qw[
- http://ind12:12359/updaeAccount?wsdl
- http://www.vbb.mcr.com/dp/ws/service
- ];
- my ( $proxy, $uri ) = ( shift, shift );
- my $soap = SOAP::Lite->proxy($proxy)->on_fault( sub { } );
- $soap->readable(1); #lifesaver
- my $raw_xml = q~
- <accountId>11</accountId>
- ~;
- open(SOAPRES,">response.xml");
- my $res = $soap->UpdateAccount( SOAP::Data->type( 'xml' => $raw_xml ) );
- my $xml = $res->paramsallt;
- print SOAPRES $xml;
- die join "\n", "--- SOAP FAULT ---", $res->faultcode, $res->faultstring, ''
- if defined($res) && $res->fault;
- die join "\n", "--- TRANSPORT ERROR ---", $soap->transport->status, ''
- if !$soap->transport->is_success;
- print STDERR join "\n", "--- SOAP RESULT ---", Dumper($res->paramsall), ''
The SOAP response:
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <soap:Envelope
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="http://www.vbb.mcr.com/dp/ws/service"
- soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
- <soap:Body>
- <UpdateAccount>
- <accountId>1111</accountId>
- </UpdateAccount>
- </soap:Body>
- </soap:Envelope>
- SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
- Connection: close
- Server: Jetty(7.x.y-SNAPSHOT)
- Content-Type: text/xml;charset=UTF-8
- Client-Date: Thu, 09 Feb 2012 06:04:00 GMT
- Client-Peer: 165.133.42.56:12359
- Client-Response-Num: 1
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:UpdateAccountResponse xmlns:ns2="http://vbb.mcr.com/dp/ws/service/customercare"><lifeEntry><lifeValidFrom>2011-02-13T01:50:43.188+01:00</lifeValidFrom><lifeValidTo>2011-02-13T01:50:43.188+01:00</lifeValidTo><lifeState>ACTIVE</lifeState><lifeSubState>STD</lifeSubState><lifeReasonCode>STD</lifeReasonCode><processed>true</processed></lifeEntry></ns2:UpdateAccountResponse></soap:Body></soap:Envelope>
Thanks,
DK