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

How to Read Array of Arrays in Client

Expand Messages
  • Michael Long
    I am trying to read back an array of arrays and I just can t figure it out. I managed to get it to return the first element but that s it. Can someone help?
    Message 1 of 1 , May 30, 2003
    View Source
    • 0 Attachment
      I am trying to read back an array of arrays and I just can't figure it out.
      I managed to get it to return the first element but that's it. Can someone
      help?

      The return is this:
      <s:complexType name="ComplexItems">
      -
      <s:sequence>
      <s:element minOccurs="1" maxOccurs="1" name="intLineItem" type="s:long"/>
      <s:element minOccurs="0" maxOccurs="1" name="strLine1" type="s:string"/>
      <s:element minOccurs="0" maxOccurs="1" name="strLine2" type="s:string"/>
      </s:sequence>
      </s:complexType>

      And here is what I am getting in the data:
      <?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><TestComplexItemsRe
      sponse
      xmlns="http://tempuri.org/"><prarComplexItems><ComplexItems><intLineItem>0<
      /intLineItem><strLine1>Line 1 of Object: 0</strLine1><strLine2>Line 2 of
      Object:
      0</strLine2></ComplexItems><ComplexItems><intLineItem>1</intLineItem><strLi
      ne1>Line 1 of Object: 1</strLine1><strLine2>Line 2 of Object:
      1</strLine2></ComplexItems><ComplexItems><intLineItem>2</intLineItem><strLi
      ne1>Line 1 of Object: 2</strLine1><strLine2>Line 2 of Object:
      2</strLine2></ComplexItems><ComplexItems><intLineItem>3</intLineItem><strLi
      ne1>Line 1 of Object: 3</strLine1><strLine2>Line 2 of Object:
      3</strLine2></ComplexItems><ComplexItems><intLineItem>4</intLineItem><strLi
      ne1>Line 1 of Object: 4</strLine1><strLine2>Line 2 of Object:
      4</strLine2></ComplexItems><ComplexItems><intLineItem>5</intLineItem><strLi
      ne1>Line 1 of Object: 5</strLine1><strLine2>Line 2 of Object:
      5</strLine2></ComplexItems><ComplexItems><intLineItem>6</intLineItem><strLi
      ne1>Line 1 of Object: 6</strLine1><strLine2>Line 2 of Object:
      6</strLine2></ComplexItems><ComplexItems><intLineItem>7</intLineItem><strLi
      ne1>Line 1 of Object: 7</strLine1><strLine2>Line 2 of Object:
      7</strLine2></ComplexItems><ComplexItems><intLineItem>8</intLineItem><strLi
      ne1>Line 1 of Object: 8</strLine1><strLine2>Line 2 of Object:
      8</strLine2></ComplexItems><ComplexItems><intLineItem>9</intLineItem><strLi
      ne1>Line 1 of Object: 9</strLine1><strLine2>Line 2 of Object:
      9</strLine2></ComplexItems><ComplexItems><intLineItem>10</intLineItem><strL
      ine1>Line 1 of Object: 10</strLine1><strLine2>Line 2 of Object:
      10</strLine2></ComplexItems></prarComplexItems></TestComplexItemsResponse><
      /soap:Body></soap:Envelope>

      And my code:
      use SOAP::Lite maptype=>{};

      my $URI = 'http://tempuri.org/';

      my $svcTestComplex = SOAP::Lite
      ->uri($URI)

      ->proxy('http://172.20.21.0/testcomplex/testcomplex/svcTestComplex.asmx?wsd
      l')
      ->on_debug(sub{print@_})
      ->on_action(sub {sprintf '%s%s', @_});

      my $resp = $svcTestComplex->TestComplexItems(
      SOAP::Data->name("pvstrTestIn"=>'1')->uri("http://tempuri.org/"));

      my $results = $resp->paramsall();
      while (my($k,$v) = each %{ $results->{ComplexItems} } )
      {
      print "K $k V $v\n";
      }

      (I tried the above with ->result instead of ->paramsall...got same thing)
    Your message has been successfully submitted and would be delivered to recipients shortly.