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

SOAP::Lite +wsdl in a object-oriented way

Expand Messages
  • and11_bf
    Hello. I m complete newbie in SOAP::Lite, so please be elenient. I m using combination of Apache + mod_perl + Apache::SOAP from SOAP::Lite distribution. I m
    Message 1 of 4 , Mar 5, 2005
    View Source
    • 0 Attachment
      Hello.

      I'm complete newbie in SOAP::Lite, so please be elenient.

      I'm using combination of Apache + mod_perl + Apache::SOAP from SOAP::Lite
      distribution.

      I'm trying to understand process of object creation on server side
      while using WSDL.

      For example, I have service 'Hello', represented by module Hello.pm on
      server side. I want to call Hello's constructor, passing some data as
      its arguments and use it in subsequent calls. But after reading
      SOAP::Lite pod doc., I still can't find the way of creating Hello object.
      All the samples I've found demonstrate how to make service calls
      described by WSDL in non-OO way, i.e.

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

      But how can I call getQuote as object method rather than class one ?
      Any help would be greatly appreciated.

      Andrew
    • jmzorko@mac.com
      Andrew, ... Is this better? my $success = eval { my $service = SOAP::Lite- service( uri://to.WSDL.file ); $service- someMethod( $someParam, @someArrayOParams
      Message 2 of 4 , Mar 5, 2005
      View Source
      • 0 Attachment
        Andrew,

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

        Is this better?

        my $success = eval
        {
        my $service = SOAP::Lite->service( "uri://to.WSDL.file" );
        $service->someMethod( $someParam, @someArrayOParams );
        };

        Regards,

        John

        Falling You - exploring the beauty of voice and sound
        New album, "Touch", available now
        http://www.magnatune.com/artists/falling_you
      • and11_bf
        ... Sorry, I ve sent prev. message to the wrong address. Thanks fore reply. Anyway, this is not what I m looking for. $service- someMethod( $someParam,
        Message 3 of 4 , Mar 5, 2005
        View Source
        • 0 Attachment
          --- In soaplite@yahoogroups.com, jmzorko@m... wrote:
          >
          > Andrew,
          >
          > > use SOAP::Lite;
          > > print SOAP::Lite
          > > ->
          > > service('http://www.xmethods.net/sd/StockQuoteService.wsdl')
          > > -> getQuote('MSFT');
          >
          > Is this better?
          >
          > my $success = eval
          > {
          > my $service = SOAP::Lite->service( "uri://to.WSDL.file" );
          > $service->someMethod( $someParam, @someArrayOParams );
          > };
          >
          > Regards,
          >
          > John
          >
          > Falling You - exploring the beauty of voice and sound
          > New album, "Touch", available now
          > http://www.magnatune.com/artists/falling_you

          Sorry, I've sent prev. message to the wrong address.
          Thanks fore reply. Anyway, this is not what I'm looking for.

          $service->someMethod( $someParam, @someArrayOParams );

          Code above calls someMethod as a class method rather than object's one.
          I.e. I'd like to have object initialized (I also waht to be able to
          pass some args. into class' constructor), something like this:

          $obj = $service->SOAP::new('args');
          $obj->someMethod(11).

          I know it is possible without using WSDL thi way:

          $service = SOAP::Lite->proxy(..)->uri(..);
          $obj = $service->call(new => 'args')->result;
          $obj->someMethod('xx');

          But I didn't see any directions on using such things with WSDL. All I
          saw is just a phrases about that in this case $service is not a
          SOAP::SOM. So, does it mean that I can't get object reference while
          using WSDL?


          Please advise.
          Thanks, Andrew
        • Duncan Cameron
          ... I don t think this will do what you are claiming. $obj will just be a variable in your client, it will not have any reference to a remote object. You still
          Message 4 of 4 , Mar 6, 2005
          View Source
          • 0 Attachment
            On 2005-03-06 at 00:11:13 and11_bf wrote:

            >--- In soaplite@yahoogroups.com, jmzorko@m... wrote:
            >>
            >> Andrew,
            >>
            >> > use SOAP::Lite;
            >> > print SOAP::Lite
            >> > ->
            >> > service('http://www.xmethods.net/sd/StockQuoteService.wsdl')
            >> > -> getQuote('MSFT');
            >>
            >> Is this better?
            >>
            >> my $success = eval
            >> {
            >> my $service = SOAP::Lite->service( "uri://to.WSDL.file"
            >>);
            >> $service->someMethod( $someParam, @someArrayOParams );
            >> };
            >>
            >> Regards,
            >>
            >> John
            >>
            >> Falling You - exploring the beauty of voice and sound
            >> New album, "Touch", available now
            >> http://www.magnatune.com/artists/falling_you
            >
            >Sorry, I've sent prev. message to the wrong address.
            >Thanks fore reply. Anyway, this is not what I'm looking for.
            >
            >$service->someMethod( $someParam, @someArrayOParams );
            >
            >Code above calls someMethod as a class method rather than object's
            >one.
            >I.e. I'd like to have object initialized (I also waht to be able to
            >pass some args. into class' constructor), something like this:
            >
            >$obj = $service->SOAP::new('args');
            >$obj->someMethod(11).
            >
            >I know it is possible without using WSDL thi way:
            >
            >$service = SOAP::Lite->proxy(..)->uri(..);
            >$obj = $service->call(new => 'args')->result;
            >$obj->someMethod('xx');

            I don't think this will do what you are claiming. $obj will just be a
            variable in your client, it will not have any reference to a remote
            object. You still need to do
            $soap->someMethod($obj, 'xx');
            to pass the object back to the remote system.
            >
            >But I didn't see any directions on using such things with WSDL. All I
            >saw is just a phrases about that in this case $service is not a
            >SOAP::SOM. So, does it mean that I can't get object reference while
            >using WSDL?
            >
            Using WSDL you can get the SOAP::SOM object from the most recent call
            by

            my $result = $service->someMethod();
            my $som = $service->call;

            The 'O' in SOAP stopped meaning 'Object' a long time ago. It is
            probably best to treat SOAP as a mechanism for RPC and for
            transferring XML documents. It is not a way of handling remote
            objects.
            S::L does provide some support for that though using 'autodispatch',
            but that will only be of use when both client and server are written
            in perl.

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