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

817Re: [soaplite] does result have to be a hash ref

Expand Messages
  • Paul Kulchenko
    Sep 12, 2001
    • 0 Attachment
      Hi, Joseph!

      > Can't call method "valueof" on unblessed reference at GetShip line
      > 23.
      Yes, because you already did ->method() call. You don't need it:

      $response = SOAP::Lite
      -> uri('http://tempuri.org/message/')
      ->
      proxy('http://comac.litorders.com/SOAP/ListShipments.ASP')
      ->
      on_action(sub{'"http://tempuri.org/action/Shipments.ListShipments"'})
      -> ListShipments(SOAP::Data->type(xml => qq!$xml!))
      ;

      @array = $response->valueof('//SOAP-ENV:Body');

      result(), valueof(), dataof() and other methods operate on SOAP::SOM
      object which is returned by method call (ListShipments) in your case.

      '//SOAP-ENV:Body' will not work as expected. Either use '//Body' to
      match all Body elements, or use
      '//{http://schemas.xmlsoap.org/soap/envelope/}Body' to match based on
      namespace and localname. In any case valueof('//Body') will return
      only one element (unless you have multiple bodies), which is
      different from what you want. If you want to get immediate children
      of Body, you may write something like:

      @array = $response->valueof('//Body/[>0]');

      or if you know names (for example, 'item'), you can write:

      @array = $response->valueof('//item');

      Hope it helps.

      Best wishes, Paul.

      --- Joseph Norris <jozefn@...> wrote:
      >
      > Thanks Paul. However I run into this situation:
      >
      > I have built a very simple script to test the information in
      > the page you sent me.
      >
      > use SOAP::Lite;
      >
      > $response = SOAP::Lite
      > -> uri('http://tempuri.org/message/')
      > ->
      > proxy('http://comac.litorders.com/SOAP/ListShipments.ASP')
      > ->
      >
      on_action(sub{'"http://tempuri.org/action/Shipments.ListShipments"'})
      > -> ListShipments(SOAP::Data->type(xml => qq!$xml!))
      > -> method();
      >
      >
      > @array = $response->valueof('//SOAP-ENV:Body');
      > for (@array){
      > print "$_\n";
      > }
      >
      > when I run this script I get
      >
      > Can't call method "valueof" on unblessed reference at GetShip line
      > 23.
      >
      > 2 returned
      >
      > Where do I go from here?
      >
      >
      > #Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
      > print @c=map chr
      > $_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,
      > -68,4,-3,-1,7,1,14,-68,-26,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
      >
      >
      > On Tue, 11 Sep 2001, Paul Kulchenko wrote:
      >
      > > Hi, Joseph!
      > >
      > > Take a look here, it may answer your question
      > > http://groups.yahoo.com/group/soaplite/message/550
      > >
      > > You may also find useful section that describes SOAP::SOM in
      > > SOAP::Lite documentation. Hope it helps.
      > >
      > > Best wishes, Paul.
      > >
      > > --- Joseph Norris <jozefn@...> wrote:
      > > >
      > > > I have had some real success with my most recent soap projects,
      > but
      > > > still
      > > > a real newbie in use of Soap::Lite - so please bare with me.
      > > >
      > > > I have the following piece of soap code
      > > >
      > > >
      > > >
      > > > $xml =
      > > >
      > qq!<XMLQuery><ListShipment><SOAPClientID>XXX</SOAPClientID><where
      > > > col='OrderDes
      > > > cription' comp='Equals'
      > > > value='$value'/></ListShipment></XMLQuery>!;
      > > >
      > > >
      > > >
      > > > use SOAP::Lite;
      > > >
      > > > $soap_response = SOAP::Lite
      > > > -> uri('http://tempuri.org/message/')
      > > > ->
      > > > proxy('http://comac.litorders.com/SOAP/ListShipments.ASP')
      > > > ->
      > > >
      > >
      >
      on_action(sub{'"http://tempuri.org/action/Shipments.ListShipments"'})
      > > > -> ListShipments(SOAP::Data->type(xml => qq!$xml!))
      > > > -> result;
      > > >
      > > >
      > > > $soap_response is a hash ref that I can get at with
      > Data::Dumper.
      > > > However
      > > > this returns hashes. It just so happens that the return of this
      > > > data has
      > > > multiple tags of the same name. I need to get the data from all
      > of
      > > > the
      > > > tags but because these tags become keys in the hash - I am only
      > > > getting the
      > > > last set of tag data that I need. I am not sure how (or if) I
      > get
      > > > the
      > > > soap_response as an array ref so that I can get all of the
      > > > information.
      > > >
      > > > Any and all suggestions would be appreciated.
      > > >
      > > > Thanks.
      > > >
      > > >
      > > > #Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
      > > > print @c=map chr
      > > > $_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,
      > > >
      > -68,4,-3,-1,7,1,14,-68,-26,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
      > > >
      > > >
      > > >
      > > > ------------------------ 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!?
      > > Get email alerts & NEW webcam video instant messaging with Yahoo!
      > Messenger
      > > http://im.yahoo.com
      > >
      > >
      > > 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/
      > >
      > >
      >
      >
      > ------------------------ 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!?
      Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
      http://im.yahoo.com
    • Show all 7 messages in this topic