fritz1968 has asked for the wisdom of the Perl Monks concerning the following question:
I am having trouble extracting data from my SOAP::Lite program. I can connect to the WSDL just fine. It even returns data. (I know because Dumper tells me it is there). My problem is trying to put said data into a variable. Here is my code:-------------------------------------------------------------------
#! /usr/bin/perl use SOAP::Lite +trace => 'debug'; use Data::Dumper; # .NET web services expect / as a separator # for uri and method. my $lite = SOAP::Lite->new()->on_action(sub { join '/', @_ } ) ->proxy('http://somewhere.net/rjam-request-service/svc/RequestServic +e/3?wsdl') ->readable(1); $response = $lite->call( SOAP::Data->name('fetchAndLock') ->attr({ 'xmlns', 'http://somewhere.net/request/servic +e/3' }), SOAP::Data->name("first")->value(3), SOAP::Data->name("max")->value(1), SOAP::Data->name("provider")->value('homeFolderWin'), SOAP::Data->name("action")->value('bestMatch'), SOAP::Data->name("state")->value('PLACED') ); my $tmp_data = $response->valueof('[1]'); print Dumper($tmp_data); my $lts=$tmp_data->dataof('//fetchAndLockResponse/request/lockedTimes' +);
and here is what is returned on my command prompt (note that I cleaned up the response a bit to make it more readable): -------------------------------------------------------------------------
why cannot I extract the locked times from using the dataof part? (I have the same problem with valueof). Any help would be greatly appreciated. Frank<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instanc +e" xmlns:S OAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="ht +tp://schem as.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSc +hema" SOAP -ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > <SOAP-ENV:Body > <fetchAndLock xmlns="http://somewhere.net/request/service/3" > <first xsi:type="xsd:int" >3</first> <max xsi:type="xsd:int" >1</max> <provider xsi:type="xsd:string" >homeFolderWin</provider> <action xsi:type="xsd:string" >bestMatch</action> <state xsi:type="xsd:string" >PLACED</state></fetchAndLock></SOAP-ENV:Body></SOAP-ENV:Envelop +e> SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK Connection: close Date: Tue, 14 Aug 2012 12:31:38 GMT Server: IBM_HTTP_Server Content-Language: en-US Content-Type: text/xml; charset=UTF-8 Client-Date: Tue, 14 Aug 2012 12:31:38 GMT Client-Peer: 169.81.175.20:80 Client-Response-Num: 1 Client-Transfer-Encoding: chunked <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <fetchAndLockResponse xmlns="http://somewhere.net/request/serv +ice/3"> <request> <id>210</id> <client>TESTING</client> <externalId>homefoldertest1241</externalId> <externalParentId>TODO</externalParentId> <provider>homeFolderWin</provider> <action>bestMatch</action> <priority>1</priority> <actionTime>2012-07-13T16:20:34.993Z</actionTime> <state>PLACED</state> <result>NONE</result> <locked>true</locked> <lockedTimes>43</lockedTimes> <arguments> <name>sid</name> <valueString>F030624</valueString> </arguments> <arguments> <name>domain</name> <valueString>NAEAST</valueString> </arguments> </request> </fetchAndLockResponse> </soap:Body> </soap:Envelope> Can't call method "dataof" on unblessed reference at test.pl line 28. ---------------------------------------------------------------------- +----------------
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: soap::lite - Can't call method "dataof" on unblessed reference
by tobyink (Canon) on Aug 14, 2012 at 13:58 UTC | |
by fritz1968 (Sexton) on Aug 14, 2012 at 14:35 UTC | |
by Anonymous Monk on Aug 15, 2012 at 02:39 UTC |