Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: SOAP::Lite, WSDLs and Raw XML Data

by Anonymous Monk
on Jun 12, 2008 at 11:03 UTC ( #691627=note: print w/ replies, xml ) Need Help??


in reply to SOAP::Lite, WSDLs and Raw XML Data

Here's an example adopted from SOAPsh.pl

#!/usr/bin/perl -- # adopted from # perl -MSOAP::Lite=debug -S SOAPsh.pl http://services.soaplite.com/ex +amples.cgi http://www.soaplite.com/My/Examples getStateList([1,9]) use warnings; use strict; use SOAP::Lite; use Data::Dumper; $Data::Dumper::Terse = 1; $Data::Dumper::Indent = 1; use SOAP::Lite +trace => 'debug'; @ARGV = qw[ http://services.soaplite.com/examples.cgi http://www.soaplite.com/My/Examples ]; my ( $proxy, $uri ) = ( shift, shift ); my $soap = SOAP::Lite->proxy($proxy)->on_fault( sub { } ); $soap->uri($uri) if $uri; $soap->readable(1); # lifesaver my $raw_xml = q~<soapenc:Array soapenc:arrayType="xsd:int[2]" xsi:type="soapenc:Ar +ray"> <item xsi:type="xsd:int">1</item> <item xsi:type="xsd:int">9</item> </soapenc:Array>~; my $res = $soap->getStateList( SOAP::Data->type( 'xml' => $raw_xml ) ) +; #my $res = $soap->getStateList([1,9]); die join "\n", "--- SOAP FAULT ---", $res->faultcode, $res->faultstrin +g, '' 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 + ), ''; __END__ SOAP::Transport::HTTP::Client::send_receive: POST http://services.soap +lite.com/examples.cgi HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 668 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://www.soaplite.com/My/Examples#getStateList" <?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" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <getStateList xmlns="http://www.soaplite.com/My/Examples"> <s +oapenc:Array soapenc:arrayType="xsd:int[2]" xsi:type="soapenc:Array"> <item xsi:type="xsd:int">1</item> <item xsi:type="xsd:int">9</item> </soapenc:Array> </getStateList> </soap:Body> </soap:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK Connection: close Date: Thu, 12 Jun 2008 10:54:40 GMT Server: Apache/1.3.37 (Unix) mod_throttle/3.1.2 DAV/1.0.3 mod_fastcgi/ +2.4.2 mod_gzip/1.3.26.1a PHP/4.4.8 mod_ssl/2.8.22 OpenSSL/0.9.7e Content-Length: 683 Content-Type: text/xml; charset=utf-8 Client-Date: Thu, 12 Jun 2008 10:58:23 GMT Client-Peer: 208.113.208.191:80 Client-Response-Num: 1 SOAPServer: SOAP::Lite/Perl/0.55 <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="ht +tp://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schem +as.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap +.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOA +P-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP +-ENV:Body><namesp1:getStateListResponse xmlns:namesp1="http://www.soa +plite.com/My/Examples"><SOAP-ENC:Array xsi:type="SOAP-ENC:Array" SOAP +-ENC:arrayType="xsd:string[2]"><item xsi:type="xsd:string">Alabama</i +tem><item xsi:type="xsd:string">Florida</item></SOAP-ENC:Array></name +sp1:getStateListResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> --- SOAP RESULT --- [ 'Alabama', 'Florida' ]


Comment on Re: SOAP::Lite, WSDLs and Raw XML Data
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://691627]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2015-07-31 00:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls