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

4930Re: [soaplite] Need help decoding SOAP response object

Expand Messages
  • Duncan Cameron
    Oct 15, 2005
    • 0 Attachment
      On 2005-10-14 at 23:50:57 Clark Ritchie wrote:

      >SOAP newbie here. I apologize for what is probably a
      >dumb question but I wasted the better part of today on
      >this and I'm really frustrated. I can see the data I
      >want, just can't get it into Perl data structures I
      >can use.
      >I'm struggling with how to interpret the data that
      >comes back to me from a web service I am calling on
      >the SugarCRM product.
      >I can see the data (email_address, user_name) buried
      >deep within the XML:
      ><?xml version="1.0"
      >What do I need to do to actually access the individual
      >This is one of the examples I tried to follow:
      >my @resultArray=();
      >foreach my $field ($som->valueof('Body'))
      > push @resultArray,$field;
      >...but I am not sure how to traverse resultArray.
      >DataDumper says it looks like this:
      >$VAR1 = {
      > 'user_listResponse' => {
      > 'return' => [
      > bless( {
      >'email_address' => 'crm@...',

      From the look of the SOAP response you can access the data directly
      without using the SOM approach.

      my $som = $soap->method( ...) ;
      my $r = $som->result;

      print "$r->[0]->{user_name}\n";
      print "$r->[0]->{email_address}\n";
      print "$r->[0]->{user_detail}\n";

      The $som->result gives you the <return> element as a refernce to an
      array of hash references.

    • Show all 3 messages in this topic