priya10 has asked for the wisdom of the Perl Monks concerning the following question:

Im trying to call a .NET web service from perl script using SOAP::Data module.My web method has a parameter methodname(....,attr[] attributes,.....) I dont know how to pass this in perl using SOAP:Data to call the method. its xml format is
<attributes> <attr> <attrName>string</attrName> <attrValue> <string>string</string> <string>string</string> </attrValue> </attr> <attr> <attrName>string</attrName> <attrValue> <string>string</string> <string>string</string> </attrValue> </attr> </attributes>
the method also has 3 out parameters.. how to pass that parameters? pls help me..

Replies are listed 'Best First'.
Re: Parameter passing using SOAP::Data in perl
by Anonymous Monk on Mar 16, 2011 at 16:53 UTC
Re: Parameter passing using SOAP::Data in perl
by Khen1950fx (Canon) on Mar 17, 2011 at 01:46 UTC
    Asking a question about SOAP::Lite seems to be almost like yelling "Fire!" in a theater:-). Here's my attempt at dousing the fire:
    #!/usr/bin/perl use strict; use warnings; use SOAP::Lite +trace => 'all'; my $soap = SOAP::Lite ->uri("http://www.example.com/") ->on_action(sub { join "/", "http://www.example.com", $_[1] } ) ->proxy("http://localhost/Example1/Service1.asmx"); my $method = SOAP::Data->name('name') ->attr({'xmlns' => "http://www.example.com/"}); my @params = (SOAP::Data->name(str1 => 'string1'), SOAP::Data->name(str2 => 'string2')); print $soap->call($method => @params)->result;
      Very good and helpful answer!!! maybe it would be better if you set the namespace in data object.
      my $soapa = SOAP::Lite->new(); $soapa->proxy("$WS_proxy"); $soapa->readable(1); $soapa->service("$WS_service"); my $data = SOAP::Data->new(); $data->uri("$WS_namespace"); my $method = $data->name('yourService'); my @params = (SOAP::Data->name('arg1' => ""), SOAP::Data->name('arg0' => "")); $result = $soapa->call($method => @params)->result; print Dumper($result); }