Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Web services client in Perl

by sshahar1 (Initiate)
on Jan 09, 2008 at 13:06 UTC ( #661342=perlquestion: print w/ replies, xml ) Need Help??
sshahar1 has asked for the wisdom of the Perl Monks concerning the following question:


Hi

I wrote my first web service in Java a week ago. The application server is glassfish and the web service package is JAX-WS.

Servlet client worked, meaning connected to the client and run the method.
I'm trying to implement a Perl client, I used the very helpful instructions here: http://guide.soaplite.com/#access%20with%20service%20description%20(wsdl) My client is based on example 6.b, meaning something like:
my $service = SOAP::Lite -> service('http://www.xmethods.net/sd/StockQuoteService.wsdl'); $result = $service->getQuote('MSFT'); print $result;

The wsdl file was created with the JAX-WS utility wsgen (as I said it was good enough for the Servlet), and imoprts the xsd file.

I am able to connect to the service, because if I try to activate a method which does not exist I get a message that the method does not exist, but when I try to run an existing method I get a warning that $result is not initialized.

Any ideas or suggestions? Is this a problem with the wsdl file? Can this be connected to the importing of the xsd file (seems not likely to me, but that's the noly difference I could see from the examples I saw)?

Many thanks

Sigal

Comment on Web services client in Perl
Download Code
Re: Web services client in Perl
by olus (Curate) on Jan 09, 2008 at 13:48 UTC
    It would be more helpful if you pasted some of your real code in order to make it easier on anyone to assist you.
    $result is not initialized, maybe you forgot to initialize $result. my $result

    You can see a working example in the thread SOAP call to .NET Service

      The code is included:
      use SOAP::Lite; print "<HTML>\n"; print " <TITLE>CGI perl web services client</TITLE>\n"; print "<br>"; my $service= SOAP::Lite -> service( 'http://localhost:8080/MyCalculatorServer/CalculatorWSService?wsdl +'); my $result = $service->getUnitCageSlot(1234); print "result is: ", $result; print "</br>\n"; #$service->getUnitCageSlot(1234); print "</HTML>\n";

      I know $service is OK, the problem is with the web method call.

      Many thanks
      Sigal
        You get the warning that $result is not initialized when you run this code?
        If not, what errors are you getting?
        Also, it would help to enable debug so that you can see what is going on behind the scenes.
        Do so by use SOAP::Lite +trace => qw(method trace debug);. Run the script from the command line and check the output.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://661342]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2014-09-22 09:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (185 votes), past polls