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

Re: Accessing complex types in SOAPLite result

Expand Messages
  • Eric Amick
    ... $soap_response is probably an array reference, so this should be @multidim = @$soap_response; ... As the warnings said, use $multidim[0] and $multidim[1]
    Message 1 of 2 , Jul 17, 2003
      > Hi all,
      > I'm rather rusty with Perl and am tasked with figuring out how
      > to
      > process array of arrays in the SOAPLite resulting (object?) from
      > the
      > web services. Here is the returning SOAP message from the web
      > service
      > on the server side:
      >
      > <?xml version="1.0" encoding="UTF-8"?>
      > <soapenv:Envelope
      > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
      > <soapenv:Body>
      > <ns1:getPersonDataResponse
      > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      > xmlns:ns1="myService">
      > <ns1:getPersonDataReturn xsi:type="soapenc:Array"
      > soapenc:arrayType="ns2:string[][2]"
      > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      > xmlns:ns2="http://www.w3.org/2001/XMLSchema">
      > <item soapenc:arrayType="ns2:string[2]">
      > <item>dummy</item>
      > <item>data</item>
      > </item>
      > <item soapenc:arrayType="ns2:string[2]">
      > <item>here</item>
      > <item>example</item>
      > </item>
      > </ns1:getPersonDataReturn>
      > </ns1:getPersonDataResponse>
      > </soapenv:Body>
      > </soapenv:Envelope>
      >
      > What I'm trying to do is actually process that with
      > SOAPLite...more
      > specifically, retreive the values such as "dummy", "data", etc. I
      > tried the following code:
      >
      > $soap_response= SOAP::Lite
      > -> uri('myService')
      > -> proxy('http://localhost:8082/axis/services/')
      > -> getPersonData(SOAP::Data->name(arg0 => \@attributes),
      > SOAP::Data->name(arg1 => \@restrictions), SOAP::Data->name(arg2
      > =>\@app_name))
      > -> result;
      >
      > @multidim= $soap_response;

      $soap_response is probably an array reference, so this should be

      @multidim = @$soap_response;

      > @row1= @{@multidim[0]};
      > @row2= @{@multidim[1]};

      As the warnings said, use $multidim[0] and $multidim[1] instead. See
      if that works any better. Data::Dumper would be very useful in
      determining just what kind of value $soap_response represents.


      Eric Amick
      Columbia, MD
    Your message has been successfully submitted and would be delivered to recipients shortly.