Loading ...
Sorry, an error occurred while loading the content.

soaplite and soap-wsdl

Expand Messages
  • aviannachao
    I am just trying to get some understanding of how to access web services through WSDL. I have this piece of code which uses SOAP::Lite, and this works: use
    Message 1 of 1 , Sep 1 1:54 PM
    • 0 Attachment
      I am just trying to get some understanding of how to access web
      services through WSDL.

      I have this piece of code which uses SOAP::Lite, and this works:

      use SOAP::Lite;
      print SOAP::Lite
      -> service('http://www.xmethods.net/sd/StockQuoteService.wsdl')
      -> getQuote('MSFT');

      However, this uses SOAP::WSDL, and this doesn't work,

      use SOAP::WSDL;

      my $soap=SOAP::WSDL
      -> new ( wsdl => 'http://www.xmethods.net/sd/StockQuoteService.wsdl' )
      -> proxy ( 'http://services.xmethods.net/soap');

      $soap->wsdlinit;

      my $som=$soap->call('getQuote', 'MSFT');

      The error I get is:

      Error processing WSDL: cannot find input message for method 'getQuote'
      (/definit
      ions/portType[@name='net.xmethods.services.stockquote.StockQuotePort']/operation
      [@name='getQuote']/input/@message) at c:/Perl/site/lib/SOAP/WSDL.pm
      line 146.

      According to SOAP::WSDL's documentation on CPAN, all you have to do is:

      use SOAP::WSDL;

      my $soap=SOAP::WSDL->new( wsdl => 'http://server.com/ws.wsdl' )
      ->proxy( 'http://myurl.com');

      $soap->wsdlinit;

      my $som=$soap->call( 'method' => [
      { name => value },
      { name => 'value' } ]);

      Which is what I did, except I am not sure about the proxy url. I
      actually looked at http://www.xmethods.net/sd/StockQuoteService.wsdl
      with a browser and took what was in the <soap:address location=""> tag.

      Help!

      Thanks bunches!
    Your message has been successfully submitted and would be delivered to recipients shortly.