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

New user help

Expand Messages
  • amigo_boy2000
    I am having trouble accessing the complex output from a web service. If I do it this way: ======================================================= my $s =
    Message 1 of 2 , Apr 4, 2004
    • 0 Attachment
      I am having trouble accessing the complex output from a web service.

      If I do it this way:

      =======================================================
      my $s = SOAP::Lite
      -> uri('urn:uddi-org:api_v2')
      -> on_action(sub { sprintf '"%s"', @_ })
      -> proxy('http://localhost:8080/uddi/inquiry', timeout =>
      $SOAP::Test::TIMEOUT);


      my $result = $s->call(SOAP::Data
      ->name('find_business')
      ->attr({xmlns => 'urn:uddi-org:api_v2', generic => '2.0'})
      => # Arguments
      SOAP::Data->name(name => '%')
      )->result;

      while ( my($key, $value) = each %{$result}) {
      print "level1 $key = $value\n";
      while ( my($key1, $value1) = each %{$value} ) {
      print " level2 $key1 = $value1\n";
      }
      }
      ===================================================

      I get a reference to a hash which also contains references to hashes.
      The problem is, I am getting back two "businessInfo" elements (in the
      trace output) but the hash only contains one.

      I read the documentation and thought it said I could get access to
      the SOAP::SOM if I used the OO interface. I tried a few things but
      they generate an incorrect SOAP message. I can't set the attributes
      on "find_business". And, it prefixes that element with "namesp1:".

      Can someone please help me or tell me where to get help? If I can
      make this work, I have a chance of using it for a large project at
      work instead of Java. I either need to know how to get access to the
      complex results of the example above. Or, I need to know how to do
      an "OO" call and set attributes (and not get the unwanted "namesp1:"
      prefix on the method element.

      Thanks,
      Mark
    • amigo_boy2000
      After poking around I m able to make this work enough for my purposes (or learn more). One thing I was doing wrong was using )- result on the end of the
      Message 2 of 2 , Apr 5, 2004
      • 0 Attachment
        After poking around I'm able to make this work enough for my purposes
        (or learn more).

        One thing I was doing wrong was using ")->result" on the end of
        the "call" method. When I tried to use my $result as an SOM object,
        it complained that it was an unblessed reference. I noticed an
        example in http://groups.yahoo.com/group/soaplite/message/3350 (a
        useful "how to" about setting complex elements) which got me to see
        it.

        I then proceeded to find $result->dataof('//businessInfo/*') doesn't
        work. After 3 hours, I noticed the posting
        http://groups.yahoo.com/group/soaplite/message/3369 (and replies to
        it). The single quotes have to be double quotes ("). After I did
        that, I was able to access multiple occurences of elements in the
        output.

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