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

4458So fustrated returning hash that does not match XML results???

Expand Messages
  • dustintodd
    Mar 5, 2005
    • 0 Attachment
      I am trying to accessing the XML results below. I expected the results
      to be array of hashes based on my reading. But it appears to be a hash
      of hashes. I have include the raw XML results, a portion of the code
      I use to access it and the program run results. I have tried a number
      of different approaches and example code without getting the results I
      want. Can anyone see what I am doing wrong?

      - Dustin -

      <?xml version="1.0" encoding="UTF-8"?>
      <soapenv:Envelope
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
      <ns1:getTableMetadataResponse
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:ns1="urn:com.cisco.nm.wlse.xmlapi.inventory">
      <getTableMetadataReturn xsi:type="ns1:TableMetadata">
      <columns xsi:type="ns1:TableColumn">
      <name xsi:type="xsd:string">CWVLWLANNUCASTKEYINDEX</name>
      <type xsi:type="xsd:string">INTEGER</type>
      </columns>
      <columns xsi:type="ns1:TableColumn">
      <name xsi:type="xsd:string">CWVLWLANNUCASTKEYLEN</name>
      <type xsi:type="xsd:string">INTEGER</type>
      </columns>
      <columns xsi:type="ns1:TableColumn">
      <name xsi:type="xsd:string">CWVLWLANNUCASTKEYVALUE</name>
      <type xsi:type="xsd:string">VARCHAR</type>
      </columns>
      <columns xsi:type="ns1:TableColumn">
      <name xsi:type="xsd:string">VLANID</name>
      <type xsi:type="xsd:string">INTEGER</type>
      </columns>
      </getTableMetadataReturn>
      </ns1:getTableMetadataResponse>
      </soapenv:Body>
      </soapenv:Envelope>


      Code to print out results

      my $tablemeta = SOAP::Lite
      -> proxy('http://XXXX:XXXXXX@10.1.1.9:1741/services/Inventory')
      -> uri('urn:com.cisco.nm.wlse.xmlapi.inventory')
      -> on_debug(sub{print@_})
      -> getTableMetadata($tlisting);

      if ($tablemeta->fault) {
      print $tablemeta->faultcode, " ", $tablemeta->faultstring, "\n",
      $tablemeta->faultdetail, "\n";
      } else {
      my $tablemetawork = $tablemeta->result;
      for my $k1 ( keys %$tablemetawork ) {
      print "k1: $k1\n";
      for my $k2 ( keys %{$tablemetawork->{ $k1 }} ) {
      print "$k1: $k2 $tablemetawork->{ $k1 }{ $k2 }\n";
      }
      }
      }


      Portion of output
      k1: columns
      columns: name VLANID
      columns: type INTEGER
    • Show all 2 messages in this topic