I had problems with SOAP calls because the server I was talking to was .NET, which apparently has problems communicating with SOAP :: Lite: http://msdn.microsoft.com/en -us / library / ms995764.aspx # soapliteperl_topic3
Even if your server is not .NET, this is another way to make your call (which works for me):
# proxy and uri strings should NOT have trialing slashes my $_uri = 'http://youruri.com/whatever'; my $_proxy = 'http://yourproxy.com/something.asmx'; my $methodName = 'GetCategories'; my @params = ( SOAP::Data->name( 'token'=>'string' ), ); my $handle = SOAP::Lite ->uri( $_uri ) ->proxy( $_proxy , timeout => 30, keep_alive => 1 ) ->on_action( sub{ $_uri . "/" . $_[1] } ); my $method = SOAP::Data ->name( $methodName ) ->attr( {xmlns => $_uri . "/"} ); my $rv = $handle->call( $method=>@params ); if( $rv->fault() ){ print "SOAP Error ($methodName) :: " . $handle->transport()->status() . "\n\t" . $rv->faultcode() . ": " . $rv->faultstring(); } else { print $rv->result(); }
Also, looking at your comment on one of the answers
codeuse SOAP :: Lite; print SOAP :: Lite → uri ('webservices.uship.com/uShipsvc.asmx?WSDL';) → proxy ('http: /webservices.uship.com') → GetCategories ('myToken') → result;
You can have uri and proxy back. Ie, the proxy should be your .asmx (without "WSDL"). If you want to use WSDL, this is a completely different connection method than using uri + proxy. See: http://guide.soaplite.com/#access%20with%20service%20description%20%28wsdl%29
source share