Reputation: 21
I am new to perl webservice call.
I am calling a wsdl webservice function and I am getting the response as 400 bad request error. I tried and googled many sites but could not get successful. Please help me in solving this issue. Below is my code.
use SOAP::Lite;
my $lite = SOAP::Lite -> service('http://localhost:8080/service.svc?wsdl');
my $arg1 ="SRC";
my $arg2 = "ARG";
my @arg3 = ('test1','test2','test3');
my @res = $lite->Func($arg1,$arg2,@arg3);
print "@res";
Upvotes: 1
Views: 3158
Reputation: 2393
I'm not sure how much of a difference there is between a WSDL and an ASMX web service. If not much, try this code sample which works for me.
my $soap = SOAP::Lite
-> uri('http://foo.com')
-> on_action( sub { join '/', 'http://foo.com', $_[1] } )
-> proxy('http://foo/services/GetEmailAddress/Service.asmx');
my $method = SOAP::Data->name('GetEmailAddress')
->attr({xmlns => 'http://foo.com/'});
my @params = ( SOAP::Data->name(username => $user) );
my $email = $soap->call($method => @params)->result;
Input is a username, output is an email address. The ASMX web service was created in .NET 3, I believe.
Everything I know about how this works I learned from http://msdn.microsoft.com/en-us/library/ms995764.aspx.
Upvotes: 0
Reputation: 1652
If you are not restrict at SOAP::Lite, I will request you to please have a look at XML::Compile::SOAP::Client
Upvotes: 0
Reputation: 8376
I just had similar problem and seemed that SOAP::Lite
may have a bug concerning handling complex data structures.
Whatever, if your SOAP method (Func
) needs 3 arguments, the last one should be reference to array.
Also, with use SOAP::Lite qw(trace)
you could debug request envelope.
Upvotes: 1