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

Handling Complex objects in SOAP::Lite

Expand Messages
  • sriya_santhanam
    Hi, I ve just started using SOAP::Lite to write a client that communicates with my web service using a WSDL. The web service returns complex objects and
    Message 1 of 3 , Jun 28, 2004
    • 0 Attachment
      Hi,

      I've just started using SOAP::Lite to write a client that communicates
      with my web service using a WSDL. The web service returns complex
      objects and SOAP::Lite handles them by constructing a nested structure
      of hashes and returning a reference.

      This worked fine until I started receiving arrays of objects. In this
      case, SOAP::Lite simply overwrites my hash (owing to the presence of
      duplicate keys) and all I receive is the last object in the array. Is
      there a way to get around this ? How can I get SOAP::Lite to treat my
      arrays as such without converting them to hashes ?

      Also, when I print out my reference, I get the following output :

      Container=HASH(0x10aa11f0)

      I'd appreciate any input on this.
      Thanks,
      Sriya
    • rafiq.ismail@mail.ing.nl
      RE: [soaplite] Handling Complex objects in SOAP::Lite Hi Sriya, I haven t really followed the list closely, but there was a recent post which seemed to cover
      Message 2 of 3 , Jun 29, 2004
      • 0 Attachment
        RE: [soaplite] Handling Complex objects in SOAP::Lite

        Hi Sriya,

        I haven't really followed the list closely, but there was a recent post which
        seemed to cover this.  I've used similar mechanisms.  The idea is to access the returned xml directly.  I usually use a sniffer proxy to look at the structure of my returned xml response.  Based on that, you can form an x-path expression and do something like (from the forementioned recent post):

        my @dataStructs = $som->valueof('//datastruct');

        Regardless, the trick is in accessing the data you need itteratively via direct xpaths.

        Hope that this is correct and that it helps.
        Cheers,

        Rafiq




        -----Original Message-----
        From:   sriya_santhanam [mailto:sriya_santhanam@...]
        Sent:   Mon 6/28/2004 9:39 PM
        To:     soaplite@yahoogroups.com
        Cc:    
        Subject:        [soaplite] Handling Complex objects in SOAP::Lite

        Hi,

        I've just started using SOAP::Lite to write a client that communicates
        with my web service using a WSDL. The web service returns complex
        objects and SOAP::Lite handles them by constructing a nested structure
        of hashes and returning a reference.

        This worked fine until I started receiving arrays of objects. In this
        case, SOAP::Lite simply overwrites my hash (owing to the presence of
        duplicate keys) and all I receive is the last object in the array. Is
        there a way to get around this ? How can I get SOAP::Lite to treat my
        arrays as such without converting them to hashes ?

        Also, when I print out my reference, I get the following output :

        Container=HASH(0x10aa11f0)

        I'd appreciate any input on this.
        Thanks,
        Sriya



        Yahoo! Groups Sponsor   
        ADVERTISEMENT
        click here <http://us.ard.yahoo.com/SIG=129ocu8ub/M=298184.5022502.6152625.3001176/D=groups/S=1705701014:HM/EXP=1088538094/A=2164339/R=0/SIG=11e2d64in/*http://www.netflix.com/Default?mqso=60183348>  
         <http://us.adserver.yahoo.com/l?M=298184.5022502.6152625.3001176/D=groups/S=:HM/A=2164339/rand=786091368>     

          _____ 

        Yahoo! Groups Links


        *       To visit your group on the web, go to:
                http://groups.yahoo.com/group/soaplite/
                 
        *       To unsubscribe from this group, send an email to:
                soaplite-unsubscribe@yahoogroups.com <mailto:soaplite-unsubscribe@yahoogroups.com?subject=Unsubscribe>
                 
        *       Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> .





        -----------------------------------------------------------------
        ATTENTION:
        The information in this electronic mail message is private and
        confidential, and only intended for the addressee. Should you
        receive this message by mistake, you are hereby notified that
        any disclosure, reproduction, distribution or use of this
        message is strictly prohibited. Please inform the sender by
        reply transmission and delete the message without copying or
        opening it.

        Messages and attachments are scanned for all viruses known.
        If this message contains password-protected attachments, the
        files have NOT been scanned for viruses by the ING mail domain.
        Always scan attachments before opening them.
        -----------------------------------------------------------------
      • eric-amick@comcast.net
        ... That means it s a hash reference. If you want to see what the reference points to, you have to dereference it yourself with something like the following:
        Message 3 of 3 , Jun 29, 2004
        • 0 Attachment
          > Also, when I print out my reference, I get the following output :
          >
          > Container=HASH(0x10aa11f0)

           

          That means it's a hash reference. If you want to see what the reference points to, you have to dereference it yourself with something like the following:

          foreach my $key (keys %$hashref) {

                print $$hashref{$key}, "\n"

          }

           

          If you aren't already using it, the Data::Dumper module can also be extremely useful in figuring out the layout of data structures.

          --
          Eric Amick
          Columbia, MD

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