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

using Soap::Lite with WSDL

Expand Messages
  • Gary Shea
    The basics of using SOAP::Lite with WSDL are pretty simple, as discussed in http://guide.soaplite.com/, but there s something I haven t been able to figure out
    Message 1 of 2 , Feb 25, 2005
    View Source
    • 0 Attachment
      The basics of using SOAP::Lite with WSDL are pretty simple, as discussed
      in http://guide.soaplite.com/, but there's something I haven't been able
      to figure out yet.

      When not using WSDL, the perl code is something like:

      print SOAP::Lite
      -> uri('http://www.soaplite.com/Demo')
      -> proxy('http://services.soaplite.com/hibye.cgi')
      -> hi()
      -> result;

      In this case an object is returned from the WS method hi(), and that
      object will take calls like result(), fault(), etc. When using WSDL the
      code is something like:

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

      Now an actual value is returned from the call to the WS method!
      It turns out that the object returned from:

      my $obj = SOAP::Lite
      -> service('http://www.xmethods.net/sd/StockQuoteService.wsdl');

      is blessed into the name of the service, and that object's
      ISA=(Exporter, SOAP::Lite). If I call $obj->fault() I get an error and
      a message listing the service methods, and informing me that those are
      the only methods available.

      So, has anyone figured out how to get at the meta-info? A method call
      like $obj->SUPER::fault doesn't work, because it refers to the SUPER of
      the package the code is called in, not the SUPER of the object $obj.
      I'm confused!

      Any hints appreciated...

      Gary
    • Duncan Cameron
      ... When not using WSDL the result of a remote method call is a SOAP::SOM object. You can get this after a WSDL call by using the call() method with no
      Message 2 of 2 , Feb 25, 2005
      View Source
      • 0 Attachment
        On 2005-02-25 at 19:18:13 Gary Shea wrote:

        >The basics of using SOAP::Lite with WSDL are pretty simple, as
        >discussed
        >in http://guide.soaplite.com/, but there's something I haven't been
        >able
        >to figure out yet.
        >
        >When not using WSDL, the perl code is something like:
        >
        >print SOAP::Lite
        > -> uri('http://www.soaplite.com/Demo')
        > -> proxy('http://services.soaplite.com/hibye.cgi')
        > -> hi()
        > -> result;
        >
        >In this case an object is returned from the WS method hi(), and that
        >object will take calls like result(), fault(), etc. When using WSDL
        >the
        >code is something like:
        >
        >print SOAP::Lite
        > -> service('http://www.xmethods.net/sd/StockQuoteService.wsdl')
        > -> getQuote('MSFT');
        >
        >Now an actual value is returned from the call to the WS method!
        >It turns out that the object returned from:
        >
        >my $obj = SOAP::Lite
        > -> service('http://www.xmethods.net/sd/StockQuoteService.wsdl');
        >
        >is blessed into the name of the service, and that object's
        >ISA=(Exporter, SOAP::Lite). If I call $obj->fault() I get an error
        >and
        >a message listing the service methods, and informing me that those
        >are
        >the only methods available.
        >
        >So, has anyone figured out how to get at the meta-info? A method
        >call
        >like $obj->SUPER::fault doesn't work, because it refers to the SUPER
        >of
        >the package the code is called in, not the SUPER of the object $obj.
        >I'm confused!
        When not using WSDL the result of a remote method call is a SOAP::SOM
        object. You can get this after a WSDL call by using the call() method
        with no parameters. It simply returns the result of the most recent
        call.

        e.g.
        my $obj = SOAP::Lite
        -> service('http://www.xmethods.net/sd/StockQuoteService.wsdl');
        my $stockprice = $obj->getQuote('MSFT');
        my $som = $obj->call;

        if ($som->fault) {
        # do something
        } else {
        print $stockprice;
        }


        Duncan
      Your message has been successfully submitted and would be delivered to recipients shortly.