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

Re: [soaplite] Parsing thru a SOAP::Lite response.... HASHES??

Expand Messages
  • Eric Bridger
    I believe you need to tell your SOAP client you want it to return an SOM object via: $client- want_som(1); Then use: foreach my $e (
    Message 1 of 2 , Jun 14, 2007
    • 0 Attachment
      I believe you need to tell your SOAP client you want it to return an
      SOM object via:

      $client->want_som(1);

      Then use:
      foreach my $e ( @{$response->valueof('//FindStreetResult/StreetInfo'){

      }

      You should also be able to get the XML returned using:

      $client->transport->http_response->content();

      Eric

      On Jun 12, 2007, at 2:13 PM, decibel3276 wrote:

      > When the resultant response is 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:Body>
      > <FindStreetResponse xmlns="http://www.mysite.com/webservices/postal/">
      > <FindStreetResult>
      > <StreetInfo>
      > <Predirectional />
      > <Street>Meadow St</Street>
      > <Zip>15236</Zip>
      > </StreetInfo>
      > <StreetInfo>
      > <Predirectional />
      > <Street>Meadow Park Dr</Street>
      > <Zip>15236</Zip></StreetInfo>
      > <StreetInfo>
      > <Predirectional />
      > <Street>White Hampton Ln</Street>
      > <Zip>15236</Zip>
      > </StreetInfo>
      > </FindStreetResult>
      > </FindStreetResponse>
      > </soap:Body>
      > </soap:Envelope>
      >
      > How would I go about getting an array of StreetInfo? Any time I try
      > to parse thru this, I either get errors or I get the last StreetInfo
      > data.
      >
      > I've tried using foreach $e(@{$result->{StreetInfo}}) and a couple of
      > other variants of that but nothing seems to be working. Anyone have
      > any helpful ideas?
      >
      > I am using: use SOAP::Lite +trace => 'debug';
      >
      > If I could only get the raw XML and parse it myself it would be a lot
      > easier.
      >
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.