Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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:


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: My client is based on example 6.b, meaning something like:
my $service = SOAP::Lite -> service(''); $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


Replies are listed 'Best First'.
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
        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?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2016-10-25 02:35 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (313 votes). Check out past polls.