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

1083SOAP call syntax

Expand Messages
  • kowalski
    Dec 10, 2001
      I am attempting to call my SOAP server ACME (implemented in Java &
      published via WSDL) using SOAP::Lite. The name of the method I would
      like to invoke is getBalance. It takes two parameters.

      So I have this:

      acmeclient.pl
      -------------
      1 use SOAP::Lite;
      2
      3 (blah blah blah, define $ACMEwsdl, $param1 and $param2)
      4
      5 $response = new SOAP::Lite
      6  -> service($ACMEwsdl)
      7   -> getBalance($param1,$param2);
      8 print $response->result;


      This gives me the error

      Can't call method "result" on an undefined value at acmeclient
      line 8

      Now, I think $response is being defined because when I make the
      following changes to lines 5-7 and comment out 8 as so:

      5 print new SOAP::Lite
      6  -> service($ACMEwsdl)
      7   -> getBalance($param1,$param2);
      8 # print $response->result;

      I see my XML string from the ACME server printed at console.

      <?xml version="1.0"?>
      <GETBALANCERESP><ACCOUNT>998091</ACCOUNT>
      <TIMESTAMP>1001092811</TIMESTAMP><BALANCE
      >214</BALANCE></GETBALANCERESP>

      I know I am doing something wrong, but I can't figure out what.

      Also (if I may ask one more): If I wanted to parse the return strings
      into a hash like

      %response = (ACCOUNT=>'998091',
      TIMESTAMP=>'1001092811',
      BALANCE=>'214');

      couldn't I just use:

      %response = (ACCOUNT=>($response->valueof('//ACCOUNT')),
      TIMESTAMP=>($response->valueof('//TIMESTAMP')),
      BALANCE=>($response->valueof('//BALANCE')));


      This seems like the thing to do based on the SOAP::SOM section of
      your help file, but I'm not sure if I need to do some intermediate
      step first.

      Thanks so much for your help (and your excellent SOAP module).



      Lon Miller
    • Show all 3 messages in this topic