title: Perl SOAP::LITE can parse array of object from WCF
body: <p>I am having a small issue with the arrayed value from a WCF service.  I have tested the WCF with WCF Storm.  However I need it in perl. I can get the part of the object that is not in the array however when I try to get the arrayed values it seems to be jumping to the second value.  Because I can see interface 2 but cannot see anything for the storage.  Any advise it extremely helpful.</p>
  
  <pre><code>#!/usr/bin/perl
  package main;
  use SOAP::Lite;
  # Variables
  my $url = 'http://&lt;MyServerName&gt;/Services/DCSP/DCSP.ServerManagement.svc?wsdl';
  my $url_debug = 'http://localhost:11040/Service1.svc?wsdl';
  my $uri = 'http://tempuri.org/';
  my $xmlns = 'http://schemas.datacontract.org/2004/07/WcfService1';
  my $selectedOS = 'Solaris';
  # Setup Network Connection
  my $soap = SOAP::Lite
  -&gt; uri($uri)
  -&gt; on_action(sub { sprintf '%sIServerManagement/%s', @_ })
  -&gt; proxy($url)
  -&gt;autotype(0)-&gt;readable(1);
  
  my $response = $soap-&gt;serverExists(SOAP::Data-&gt;new(name =&gt; '_serverNamee', value =&gt; '&lt;ServerName&gt;'));
  # Print the Result
  if ($response-&gt;fault)
  {
   die $response-&gt;faultstring;
  }
  else
  {
  if($response-&gt;result &gt; 0) {
          my $serverID = $response-&gt;result;
          my $buildserver = $soap-&gt;getServerById(SOAP::Data-&gt;new(name =&gt; '_id', value =&gt; $serverID));
          my $cpus = $buildserver-&gt;valueof('//*/CPUs');
  
          my $host = $buildserver-&gt;valueof('//*/Host');
          my $hostname = $buildserver-&gt;valueof('//*/HostName');
          my $memoryMB = $buildserver-&gt;valueof('//*/MemoryMB');
          my $OS = $buildserver-&gt;valueof('//*/OperatingSystem');
          my $stack = $buildserver-&gt;valueof('//*/Stack');
          my $status = $buildserver-&gt;valueof('//*/Status');
          my $tier = $buildserver-&gt;valueof('//*/Tier');
          my $arch = $buildserver-&gt;valueof('//*/architecture');
          my @interfaces = $buildserver-&gt;valueof('//*/*/systemInterface');
          my @mounts = $buildserver-&gt;valueof('//*/*/systemStorage');
  
          foreach $interface (@interfaces)
          {
                  my $ipid = $interface-&gt;{'IPID'};
                  my $position = $interface-&gt;{'Position'};
                  my $ipaddress = $soap-&gt;getIpAddressByID(SOAP::Data-&gt;new(name =&gt; '_ID', value =&gt; $ipid));
  
                  my $gateway = $ipaddress-&gt;valueof('//*/gateway');
                  my $mask = $ipaddress-&gt;valueof('//*/mask');
                  my $vlan = $ipaddress-&gt;valueof('//*/vlanID');
                  my $ip = $ipaddress-&gt;valueof('//*/address');
          }
      foreach $mount (@mounts)
          {
                  my $mountpoint = $mount-&gt;{'Anchor'};
                  my $size = $mount-&gt;{'SizeMB'};
          }
  }
  }
  </code></pre>
  
  <p>Output from WCF Storm:</p>
  
  <pre><code>&lt;getServerById&gt;
    &lt;MethodParameters&gt;
      &lt;virtualServer&gt;
        &lt;systemInterface attr0="NetworkInterfaceArray" isNull="false"&gt;
          &lt;NetworkInterfaceArray0&gt;
            &lt;IPID&gt;4&lt;/IPID&gt;
            &lt;Position&gt;0&lt;/Position&gt;
            &lt;SystemID&gt;3&lt;/SystemID&gt;
            &lt;id&gt;11&lt;/id&gt;
            &lt;EntityKey&gt;System.Data.EntityKey&lt;/EntityKey&gt;
          &lt;/NetworkInterfaceArray0&gt;
          &lt;NetworkInterfaceArray1&gt;
            &lt;IPID isNull="true" /&gt;
            &lt;Position&gt;0&lt;/Position&gt;
            &lt;SystemID&gt;3&lt;/SystemID&gt;
            &lt;id&gt;19&lt;/id&gt;
            &lt;EntityKey&gt;System.Data.EntityKey&lt;/EntityKey&gt;
          &lt;/NetworkInterfaceArray1&gt;
        &lt;/systemInterface&gt;
        &lt;systemSpecs&gt;
          &lt;CPUs&gt;1&lt;/CPUs&gt;
          &lt;Host&gt;&lt;HOST&gt;&lt;/Host&gt;
          &lt;HostName&gt;&lt;HostName&lt;/HostName&gt;
          &lt;MemoryMB&gt;2048&lt;/MemoryMB&gt;
          &lt;OperatingSystem&gt;Solaris 10&lt;/OperatingSystem&gt;
          &lt;Stack&gt;Development&lt;/Stack&gt;
          &lt;Status&gt;Approved&lt;/Status&gt;
          &lt;Tier&gt;Teir 1 (Front End)&lt;/Tier&gt;
          &lt;architecture&gt;T-Series&lt;/architecture&gt;
          &lt;id&gt;3&lt;/id&gt;
          &lt;EntityKey&gt;System.Data.EntityKey&lt;/EntityKey&gt;
        &lt;/systemSpecs&gt;
        &lt;systemStorage attr0="StorageArray" isNull="false"&gt;
          &lt;StorageArray0&gt;
            &lt;Anchor&gt;/def&lt;/Anchor&gt;
            &lt;SizeMB&gt;2048&lt;/SizeMB&gt;
            &lt;SystemID&gt;3&lt;/SystemID&gt;
            &lt;id&gt;11&lt;/id&gt;
            &lt;EntityKey&gt;System.Data.EntityKey&lt;/EntityKey&gt;
          &lt;/StorageArray0&gt;
        &lt;/systemStorage&gt;
      &lt;/virtualServer&gt;
    &lt;/MethodParameters&gt;
  &lt;/getServerById&gt;
  </code></pre>
  
  <p>Reponse from debug:</p>
  
  <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;s:Body&gt;
      &lt;getServerByIdResponse xmlns="http://tempuri.org/"&gt;
        &lt;getServerByIdResult xmlns:a="http://schemas.datacontract.org/2004/07/DCSP.DataClasses" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;
          &lt;a:systemInterface&gt;
            &lt;a:NetworkInterface xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="i1"&gt;
              &lt;EntityKey xmlns="http://schemas.datacontract.org/2004/07/System.Data.Objects.DataClasses" xmlns:b="http://schemas.datacontract.org/2004/07/System.Data" z:Id="i2"&gt;
                &lt;b:EntityContainerName&gt;DCSPEntities&lt;/b:EntityContainerName&gt;
                &lt;b:EntityKeyValues&gt;
                  &lt;b:EntityKeyMember&gt;
                    &lt;b:Key&gt;id&lt;/b:Key&gt;
                    &lt;b:Value i:type="c:int" xmlns:c="http://www.w3.org/2001/XMLSchema"&gt;11&lt;/b:Value&gt;
                  &lt;/b:EntityKeyMember&gt;
                &lt;/b:EntityKeyValues&gt;
                &lt;b:EntitySetName&gt;NetworkInterfaces&lt;/b:EntitySetName&gt;
              &lt;/EntityKey&gt;
              &lt;a:IPID&gt;4&lt;/a:IPID&gt;
              &lt;a:Position&gt;0&lt;/a:Position&gt;
              &lt;a:SystemID&gt;3&lt;/a:SystemID&gt;
              &lt;a:id&gt;11&lt;/a:id&gt;
            &lt;/a:NetworkInterface&gt;
            &lt;a:NetworkInterface xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="i3"&gt;
              &lt;EntityKey xmlns="http://schemas.datacontract.org/2004/07/System.Data.Objects.DataClasses" xmlns:b="http://schemas.datacontract.org/2004/07/System.Data" z:Id="i4"&gt;
                &lt;b:EntityContainerName&gt;DCSPEntities&lt;/b:EntityContainerName&gt;
                &lt;b:EntityKeyValues&gt;
                  &lt;b:EntityKeyMember&gt;
                    &lt;b:Key&gt;id&lt;/b:Key&gt;
                    &lt;b:Value i:type="c:int" xmlns:c="http://www.w3.org/2001/XMLSchema"&gt;19&lt;/b:Value&gt;
                  &lt;/b:EntityKeyMember&gt;
                &lt;/b:EntityKeyValues&gt;
                &lt;b:EntitySetName&gt;NetworkInterfaces&lt;/b:EntitySetName&gt;
              &lt;/EntityKey&gt;
              &lt;a:IPID i:nil="true"/&gt;
              &lt;a:Position&gt;0&lt;/a:Position&gt;
              &lt;a:SystemID&gt;3&lt;/a:SystemID&gt;
              &lt;a:id&gt;19&lt;/a:id&gt;
            &lt;/a:NetworkInterface&gt;
          &lt;/a:systemInterface&gt;
          &lt;a:systemSpecs xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="i5"&gt;
            &lt;EntityKey xmlns="http://schemas.datacontract.org/2004/07/System.Data.Objects.DataClasses" xmlns:b="http://schemas.datacontract.org/2004/07/System.Data" z:Id="i6"&gt;
              &lt;b:EntityContainerName&gt;DCSPEntities&lt;/b:EntityContainerName&gt;
              &lt;b:EntityKeyValues&gt;
                &lt;b:EntityKeyMember&gt;
                  &lt;b:Key&gt;id&lt;/b:Key&gt;
                  &lt;b:Value i:type="c:int" xmlns:c="http://www.w3.org/2001/XMLSchema"&gt;3&lt;/b:Value&gt;
                &lt;/b:EntityKeyMember&gt;
              &lt;/b:EntityKeyValues&gt;
              &lt;b:EntitySetName&gt;Computers&lt;/b:EntitySetName&gt;
            &lt;/EntityKey&gt;
            &lt;a:CPUs&gt;1&lt;/a:CPUs&gt;
            &lt;a:Host&gt;Host&lt;/a:Host&gt;
            &lt;a:HostName&gt;HostName&lt;/a:HostName&gt;
            &lt;a:MemoryMB&gt;2048&lt;/a:MemoryMB&gt;
            &lt;a:OperatingSystem&gt;Solaris 10&lt;/a:OperatingSystem&gt;
            &lt;a:Stack&gt;Development&lt;/a:Stack&gt;
            &lt;a:Status&gt;Approved&lt;/a:Status&gt;
            &lt;a:Tier&gt;Teir 1 (Front End)&lt;/a:Tier&gt;
            &lt;a:architecture&gt;T-Series&lt;/a:architecture&gt;
            &lt;a:id&gt;3&lt;/a:id&gt;
          &lt;/a:systemSpecs&gt;
          &lt;a:systemStorage&gt;
            &lt;a:Storage xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="i7"&gt;
              &lt;EntityKey xmlns="http://schemas.datacontract.org/2004/07/System.Data.Objects.DataClasses" xmlns:b="http://schemas.datacontract.org/2004/07/System.Data" z:Id="i8"&gt;
                &lt;b:EntityContainerName&gt;DCSPEntities&lt;/b:EntityContainerName&gt;
                &lt;b:EntityKeyValues&gt;
                  &lt;b:EntityKeyMember&gt;
                    &lt;b:Key&gt;id&lt;/b:Key&gt;
                    &lt;b:Value i:type="c:int" xmlns:c="http://www.w3.org/2001/XMLSchema"&gt;11&lt;/b:Value&gt;
                  &lt;/b:EntityKeyMember&gt;
                &lt;/b:EntityKeyValues&gt;
                &lt;b:EntitySetName&gt;Storages&lt;/b:EntitySetName&gt;
              &lt;/EntityKey&gt;
              &lt;a:Anchor&gt;/def&lt;/a:Anchor&gt;
              &lt;a:SizeMB&gt;2048&lt;/a:SizeMB&gt;
              &lt;a:SystemID&gt;3&lt;/a:SystemID&gt;
              &lt;a:id&gt;11&lt;/a:id&gt;
            &lt;/a:Storage&gt;
          &lt;/a:systemStorage&gt;
        &lt;/getServerByIdResult&gt;
      &lt;/getServerByIdResponse&gt;
    &lt;/s:Body&gt;
  &lt;/s:Envelope&gt;
  </code></pre>