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

Re: [soaplite] SOAP::Lite ByRef Output Parameters

Expand Messages
  • Paul Kulchenko
    Hi, univertical! That s interesting. ... You need to call method in list context to get output parameters: my($res, @output) = SOAP::Lite -
    Message 1 of 2 , Oct 4, 2001
    • 0 Attachment
      Hi, univertical!

      That's interesting.

      > %res = SOAP::Lite
      > -> service('http://server/soap/GetStuff.wsdl')
      > -> GetProduct(\$out_img, \$out_nm, \$out_wgh);
      You need to call method in list context to get output parameters:

      my($res, @output) = SOAP::Lite
      -> service('http://server/soap/GetStuff.wsdl')
      -> GetProduct($out_img, $out_nm, $out_wgh);

      For in/out parameters situation is little bit more tricky. To match
      between in and out parameters SOAP::Lite uses combination of
      name+type, so your variable has to be SOAP::Data object to provide
      name and type information:

      my $param1 = 10;
      my $param2 = SOAP::Data->name('myparam' => 12);
      my $result = $s->autobind($param1, $param2)->result;

      if call autobind from My::Parameters, $param2->value should be 24
      after that. It shouldn't work though with service/WSDL calls, because
      in this case parameters are used by value and name, type and other
      information is added to create a proper call. Next version may update
      your in/out parameters, but you still need to provide a SOAP::Data
      object:

      $out_img = SOAP::Data->name('Image')->type('base64Binary');
      my($res, @output) = SOAP::Lite
      -> service('http://server/soap/GetStuff.wsdl')
      -> GetProduct($out_img, $out_nm, $out_wgh);
      print $out_img->value;

      @output array and update of provided parameters (for in/out
      parameters) are not related, you can always get all output parameters
      as the result of method call.

      Your best bet is to use technique as above and assign result to
      array/list, where you shoudl get a result, in/out and out parameters
      in a order specified in WSDL file. Let me know if you still have a
      problem.

      Best wishes, Paul.

      --- univertical@... wrote:
      > Greetings,
      >
      > I've written a server in VB 6 that is exposed by a WSDL file.
      > This is the request and the response:
      >
      > <message name='test.GetProduct'>
      > <part name='Image' type='xsd:base64Binary'/>
      > <part name='Units' type='xsd:string'/>
      > <part name='Weight' type='xsd:string'/>
      > </message>
      > <message name='test.GetProductResponse'>
      > <part name='Result' type='xsd:anyType'/>
      > <part name='Image' type='xsd:base64Binary'/>
      > <part name='Units' type='xsd:string'/>
      > <part name='Weight' type='xsd:string'/>
      > </message>
      >
      > In order to get several values back in the response, I am using
      > ByRef
      > output parameters. (Feel free to suggest a different solution :-))
      > I
      > pass these parameters in, and if using MSSoap.SoapClient, they are
      > populated with the Image, Units, and Weight parts. That's all fine
      > and good. But I decided to test the SOAP-server with SOAP::Lite,
      > and
      > wrote up this script:
      >
      > use SOAP::Lite;
      >
      > %res = SOAP::Lite
      > -> service('http://server/soap/GetStuff.wsdl')
      > -> GetProduct(\$out_img, \$out_nm, \$out_wgh);
      >
      > print %res;
      >
      > The output is as follows:
      >
      > C:\>perl soaplite.pl
      > Result=HASH(0x234d424)
      >
      > Is output parameters supposed to work? (They are not initialized
      > with
      > any values after the SOAP-call.) How do I get to the elements of
      > the
      > SOAP response? :-)
      >
      > Thanks!
      >
      >
      >
      >
      >
      >
      > ------------------------ Yahoo! Groups Sponsor
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Do You Yahoo!?
      NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
      http://geocities.yahoo.com/ps/info1
    Your message has been successfully submitted and would be delivered to recipients shortly.