#!/usr/bin/perl --
# adopted from
# perl -MSOAP::Lite=debug -S SOAPsh.pl http://services.soaplite.com/examples.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~
- 1
- 9
~;
my $res = $soap->getStateList( SOAP::Data->type( 'xml' => $raw_xml ) );
#my $res = $soap->getStateList([1,9]);
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 ), '';
__END__
SOAP::Transport::HTTP::Client::send_receive: POST http://services.soaplite.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"
- 1
- 9
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
- Alabama
- Florida
--- SOAP RESULT ---
[
'Alabama',
'Florida'
]