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

3816How do I access a return value that is an array?

Expand Messages
  • Larry Helmerich
    Aug 5, 2004
      I'm new to both SOAP::Lite and Perl

      I have a webservice with two methods.
      The first method is passed a String and returns a String
      The seond method is passed a String and returns an Array of Strings.

      Here is my program

      #use SOAP::Lite + trace => 'debug';
      use SOAP::Lite;
      my $ipAddr = $ARGV[0];
      my $wsdl = "http://localhost:8080/locate-jaxrpc/loc
      my $service = SOAP::Lite->service($wsdl);
      print $service->getMacByIp($ipAddr), "\n";

      $som = $service->browseByIp($ipAddr);
      print $som->valueof('//browseByIpResponse');

      The first method (getMacByIp) works fine.
      When I run by program I get the following output
      Can't call method "valueof" on unblessed reference at getMacByIp2.pl
      line 9.

      I have tried numerous ways to access the return value of browseByIp.
      I read a number of articles that suggested using SOM to access
      complex data types, but I'm not sure exactly how I should be doing
      this or if there is a better way of doing what I want.

      If I turn tracing on the SOAP message for browseByIp is:
      <?xml version="1.0" encoding="UTF-8"?>
      <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"

      <result href="#ID1"/>
      <ns0:ArrayOfstring id="ID1" xsi:type="enc:Array"
      <item xsi:type="xsd:string">001edb:87e4aa,, OmniStack 8008, 1/3, Wed Aug04 16:51:22 PDT
      <item xsi:type="xsd:string">001bdb:87c2aa,,
      NMS_GATEWAY, 5/24, Wed Aug 04 16:50:50 PDT 2004</item>
      <item xsi:type="xsd:string">001ccb:87c4aa,,
      OmniStack 6024, 4/5, Wed Aug04 10:53:20 PDT 2004</item>
      <item xsi:type="xsd:string">001ccb:87e4aa,,
      OmniStack 8008, 1/1, Wed Aug 04 10:52:59 PDT 2004</item>
      <item xsi:type="xsd:string">000ccb:87e4aa,,
      OmniStack 6024, 1/12, Wed Aug04 06:53:32 PDT 2004</item>
      <item xsi:type="xsd:string">001ccb:87e4aa,,
      NMS_125, 1/1, Tue Aug 03 08:23:55 PDT 2004</item>
      <item xsi:type="xsd:string">001ccb:87e4aa,,
      Hawk122, 1/1, Sat Jul10 20:37:20 PDT 2004</item>
      <item xsi:type="xsd:string">001ccb:87e4aa,,
      Falcon_127, 1/2, Mon May 17 08:33:01 PDT 2004</item>

      Any help would be appreciated
    • Show all 2 messages in this topic