Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

SOAP::Lite & WSDL Problem

by rr2000 (Novice)
on Aug 27, 2008 at 08:16 UTC ( #707107=perlquestion: print w/replies, xml ) Need Help??
rr2000 has asked for the wisdom of the Perl Monks concerning the following question:

I wrote this simple code to test a WSDL service:
use SOAP::Lite; print SOAP::Lite -> service('') -> GetCitiesByCountry('Singapore');
but when I run it, all I get is an empty output:
$ perl -w $
No error or anything! So I suppose it's connecting but method call is not quite right. Any1 know what's wrong? I use the latest SOAP::Lite version. PERL is v5.8.8. TIA!

Replies are listed 'Best First'.
Re: SOAP::Lite & WSDL Problem
by ForgotPasswordAgain (Deacon) on Aug 27, 2008 at 08:32 UTC

    You can debug a bit:

    ... use SOAP::Lite +trace => 'all'; ... SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Ser +ver Error. ... <soap:Fault> <faultcode>soap:VersionMismatch</faultcode> <faultstring>System.Web.Services.Protocols.SoapException: Possib +le SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.o +rg/wsdl/soap/ was unexpected. Expecting +ap/envelope/. at System.Web.Services.Protocols.SoapServerProtocol.CheckHelperVers +ion() at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters( +) at System.Web.Services.Protocols.WebServiceHandler.Invoke() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessReque +st()</faultstring> <detail /> </soap:Fault>

    You might want to look in the "INTEROPERABILITY" section in the SOAP::Lite docs. Note that there's also a SOAP::WSDL module that I've noticed being worked on recently but haven't tried yet.

Re: SOAP::Lite & WSDL Problem
by tilly (Archbishop) on Aug 27, 2008 at 16:04 UTC
    I had a similar problem last year. After trying several things I gave up on doing WSDL in Perl and wrote my project in Java.

    Since then XML::Compile has come on the scene. I have heard better things about its WSDL support than previously Perl modules, but I have not personally tried it. Still it is worth a shot.

Re: SOAP::Lite & WSDL Problem
by Khen1950fx (Canon) on Aug 27, 2008 at 17:39 UTC
    This worked for me:

    #!/usr/bin/perl use strict; use warnings; use SOAP::Lite; use SOAP::WSDL; my $soap = SOAP::Lite->service(' +her.asmx?WSDL'); $soap->GetCitiesByCountry('Singapore'); print $soap, "\n";
      "worked" how? It doesn't print anything useful.
Re: SOAP::Lite & WSDL Problem
by Perlbotics (Chancellor) on Aug 27, 2008 at 18:57 UTC
    Works 'somehow' under perl 5.8.8 (SuSE Linux 10.2).
    Versions: SOAP::Lite v0.60, WSDL v2.00.05

    When dumping the response using Data::Dumper, I get:

    ... 'System.Web.Services.Protocols.SoapException: Server was unable to p +rocess request. ---> System.Data.SqlClient.SqlException: Procedure or + function \'getWCity\' expects parameter \'@CountryName\', which was +not supplied. at WebServicex.GlobalWeather.GetCitiesByCountry(String CountryName) ...

    So, there seems to be a problem with the query or what the WDSL module made with it?

    I guess, you already checked connectivity- and name resolution issues like i.e. telnetting port 80 of

Re: SOAP::Lite & WSDL Problem
by morgon (Curate) on Nov 29, 2009 at 23:34 UTC
    I have exactly the same problem.

    The thing is that SOAP::Lite uses the wrong namespace in the envelope here.

    The funny thing is that if you do this:

    my $soap = SOAP::Lite->service(" +er.asmx?WSDL"); print Dumper($soap->serializer->{_namespaces});
    you can see that the proper namespace is actually registered but it later seems to get overwritten in the serializer...
    Explicitely calling register_ns does not change a thing, so I really think it is a bug.

    I finally got it working (without WSDL alas) like this:

    use strict; use SOAP::Lite +trace => "debug"; my $address = ''; my $action = "http://www.webserviceX.NET/GetCitiesByCountry"; my $namespace = 'http://www.webserviceX.NET'; my $call = "GetCitiesByCountry"; my $soap = SOAP::Lite ->uri($namespace) ->on_action(sub { $action } ) ->proxy($address); my $arg = SOAP::Data->name(CountryName => "Singapore"); $soap->call($call => $arg);
    Quite a lot of work for such a simple thing - is this because .NET is quirky or is it that SOAP::Lite (I have 0.710.10) has problems with WSDL (or am I simply being stupid?).
Re: SOAP::Lite & WSDL Problem
by Chewy (Initiate) on Jan 10, 2010 at 19:53 UTC
    I ran into the same problem with a WSDL provided by a Sun Glassfish server, the result is just empty, whereas I expect to get "Hello Chewy" Using python suds this works without problems. My code:
    use SOAP::Lite +trace => "debug"; use SOAP::WSDL; use Data::Dumper; my $soap = SOAP::Lite->service(" +ebserviceService?wsdl"); print Dumper($soap->serializer->{_namespaces}); print "\n\nRESULT:\n".Dumper $soap->hello('Chewy')."\n\n";
    Result (shortened):
    $VAR1 = { '' => 'xsd', '' => 'soapenc', '' => 'xsi', '' => 'soap' }; SOAP::Transport::HTTP::Client::send_receive: POST +:8081/Webservice/WebserviceService HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 567 Content-Type: text/xml; charset=utf-8 SOAPAction: "" __cut__ SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK <?xml version="1.0" ?><S:Envelope xmlns:S=" +soap/envelope/"><S:Body><ns2:helloResponse xmlns:ns2="http://Webservi +ces/"/></S:Body></S:Envelope> RESULT: $VAR1 = ' ';
    Is there any way I can make Perl use this WSDL. I also used (SOAP::Lite) and then using the created packages. However also there the results are empty.
Re: SOAP::Lite & WSDL Problem
by rahed (Scribe) on Aug 28, 2008 at 19:54 UTC
    There are issues with generating a soap call directly from wsdl.

    I get an answer with this code:
    $soap = SOAP::Lite->new( uri => ("http://www.webserviceX.NET"), proxy => ('') +, ); $soap->on_action(sub{join '/',@_ }); my $city = SOAP::Data->name(CountryName => 'Singapore'); my $som = $soap->GetCitiesByCountry($city); if (my $match = $som->match('/Envelope/Body/GetCitiesByCountryResponse +/')) { print "match is OK: $match\n"; my $result = $som->valueof('//GetCitiesByCountryResponse/GetCitiesBy +CountryResult'); print Dumper($result); } else { print "match not OK: $match\n"; }
    match is OK: 1 $VAR1 = '<NewDataSet> <Table> <Country>Singapore</Country> <City>Singapore / Paya Lebar</City> </Table> <Table> <Country>Singapore</Country> <City>Singapore / Changi Airport</City> </Table> </NewDataSet>';
      There are issues with generating a soap call directly from wsdl.

      Could you expand on that? I'm banging my head against this particular brick wall right now...

        To be clearer - I have a service that responds fine to my hand-crafted XML sent using LWP, but b0rks when I try to access it via SOAP::Lite. I suspect the WSDL stuff is the key to what's going wrong, but unfortunately I don't have the 'proxy' URL available to me.
        I saw some people had poor results with generating xml code directly from service description.
        I tried several times to verify and wasn't successful as well but didn't dig into.
        I prefer coding the message through SOAP::Data class manually.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://707107]
Approved by Corion
[jedikaiti]: Hi, Monks
[marto]: heya jedikaiti!
[jedikaiti]: Cute Robot!
[jedikaiti]: How's life, marto?
[marto]: I saw this robot the other day, pretty fancy stuff. Things are pretty good jedikaiti, improving :) How are things with you?
[jedikaiti]: Doing OK, but a little achy this AM - I think the cats were using me as a wrestling mat and mattress while I was asleep last night.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (18)
As of 2017-07-25 15:04 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (374 votes). Check out past polls.