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

Re: [soaplite] Decoding arrays of structures containing arrays

Expand Messages
  • Byrne Reese
    Could it be as simple as: -- CUT HERE -- foreach my $m ( $som- dataof( //Messages )) { print $m- {description}; } -- CUT HERE -- It is a valid XPath statement
    Message 1 of 3 , Feb 24, 2004
      Could it be as simple as:

      -- CUT HERE --
      foreach my $m ( $som->dataof('//Messages')) {
      print $m->{description};
      }
      -- CUT HERE --

      It is a valid XPath statement afterall... but you may want to access each
      segment of message elements independently from one another...

      >
      >
      >
      >
      > I have written a SOAP::Lite Client to query a SOAP server using complex
      > data types. I am having problems decoding the response. The response
      > that is returned is similar to the following:
      >
      >>?xml version="1.0" encoding="utf-8"?soap:Envelope
      >> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      >> xmlns:xsd="http://www.w3.org/2001/XMLSchema"soap:BodyfooResponse
      >> xmlns="http://foo.bar/foible/"fooResultfooOutRecordId/RecordIdTransactionStatusStatusCode/StatusCodeMessagesMessageDescription/DescriptionSeverity/Severity/Message/Messages/TransactionStatus/fooOutfooOutRecordId/RecordIdTransactionStatusStatusCode/StatusCodeMessages
      >> //TransactionStatus/fooOutResponseControlTableRequestId/RequestIdRequestStatusStatusCode/StatusCodeMessagesMessageDescription/DescriptionSeverity/Severity/MessageMessageDescription/DescriptionSeverity/Severity/MessageMessageDescription/DescriptionSeverity/Severity/MessageMessageDescription/DescriptionSeverity/Severity/Message/Messages/RequestStatus/ResponseControlTable/fooResult/fooResponse/soap:Body/soap:Envelope
      >
      >
      >
      >
      >
      >
      >
      > 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
      > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >


      ^byrne :/
    • Jenni Bennett
      Byrne, ... It was as simple as substituting double quotes for single... i.e. foreach my $m (
      Message 2 of 3 , Feb 24, 2004
        Byrne,

        On Tue, 24 Feb 2004, Byrne Reese wrote:

        > Could it be as simple as:
        >
        > -- CUT HERE --
        > foreach my $m ( $som->dataof('//Messages')) {
        > print $m->{description};
        > }
        > -- CUT HERE --
        >
        > It is a valid XPath statement afterall... but you may want to access each
        > segment of message elements independently from one another...

        It was as simple as substituting double quotes for single...

        i.e.
        foreach my $m (
        $som->dataof("//fooResponse/fooResult/[$i]/TransactionStatus/Messages/*"))
        {
        print "Code: " . $m->{'Code'} . "\n";
        }

        instead of:

        foreach my $m (
        $som->dataof('//fooResponse/fooResult/[$i]/TransactionStatus/Messages/*'))
        {
        print "Code: " . $m->{'Code'} . "\n";
        }

        Oops. :-/

        Thanks for the response.

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