On 2003-05-07 Alberto Accomazzi wrote:
>> Date: Wed, 07 May 2003 04:47:59 -0000
>> From: "Kamlesh" <kp52r11@...>
>> Subject: valueof usage help needed
>> I have this code.
>> #!c:\perl\bin\perl.exe -w
>> use SOAP::Lite;
>> use Data::Dumper;
>> my $soap = SOAP::Lite
>> my $som = $soap->OpGet(SOAP::Data->name("Request_ID"
>> => '000000000000002'));
>> print $som->valueof('//Envelope/Body/OpGetResponse/Full_Name') ;
>> print $som->valueof('//Envelope/Body/OpGetResponse/Email_Address');
>> I know my wsdl works.
>> But I don't know how to get the response back. There are 2 values
>> returned back but I can't figure out how to use it.
>> I am getting this error:
>> Can't call method "valueof" without a package or object reference at
>> C:\DOCUME~1\kp52r11\LOCALS~1\Temp\dir138.tmp\r3.pl line 13.
> From what I can tell if you give SOAP::Lite a WSDL file to instantiate
>your SOAP object, it will deserialize the response into a hash (rather
>than returning a SOAP::SOM object). My guess is that this is a
>"feature" although it's not clear to me why things were done this way
>and if there is any workaround. Among other things, this becomes a
>problem if you want to check for a fault.
>To see the contents of the returned value, I suggest you do this:
>my $hash = $soap->OpGet(SOAP::Data->name("Request_ID" =>
As Alberto points out, when using service() SOAP::Lite returns the actual
result, not a SOM object. The way to get hold of the SOM object when
using a service is
$som = $soap->call;
# with no parameters call() returns the result of the last call