in reply to Calling .NET based service using SOAP::Lite for Perl
Instead use SOAP::WSDL (a subclass of SOAP::Lite) to talk to the web-service. It reads the service's WSDL and constructs a proxy object whose methods are able to marshal pure-perl datastructures to and from the web-service.
It's otherwise like SOAP::Lite so you can skip straight to the 'USAGE' section of the documentation.
As with SOAP::Lite (and not mentioned in SOAP::WSDL's docs) you can use $proxy->method(...) instead of $proxy->call('method'...)
Updated:
I don't know the specifics of your complexTypes, but you can use something like the following code. Also you likely don't need to specify namespaces as that should be dealt with by SOAP::WSDL.
Note that the arguments to the method are determined positionally, and that you needn't construct a real Tester object (although if the Tester object you pass is a blessed hash, it doesn't hurt).use SOAP::WSDL; use Data::Dumper; use strict; my $soap = SOAP::WSDL->new(); $soap->wsdl('http://server/path/to.wsdl'); $soap->on_action(sub { return $_[0].$_[1]; }); # I find this he +lps with .NET services. $soap->proxy('http://server/path/to/service.asmx'); # For speed: not + necessary as SOAP::WSDL can find it in the WSDL. $soap->wsdlinit(caching => 1); my $som = $soap->SampleTest({ Name => 'Nathan', Age => 22}); if ($som->fault) { print "SampleTest Error: ".$som->faultstring."\n"; } else { print Dumper($som->paramsall); }
Also, please remember to use <code>...</code> tags when you post code so that it's easier for your fellow monks to read your post.
-David
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Calling .NET based service using SOAP::Lite for Perl
by Khurrum (Novice) on Nov 06, 2007 at 06:48 UTC | |
by erroneousBollock (Curate) on Nov 06, 2007 at 08:22 UTC | |
by erroneousBollock (Curate) on Nov 06, 2007 at 08:23 UTC | |
by Khurrum (Novice) on Nov 06, 2007 at 17:56 UTC | |
by erroneousBollock (Curate) on Nov 07, 2007 at 06:53 UTC |