php soapclient responds as 'null' but xml response is ok using __getLastResponse

Posted by Roger S on Stack Overflow See other posts from Stack Overflow or by Roger S
Published on 2012-06-16T21:11:18Z Indexed on 2012/06/16 21:16 UTC
Read the original article Hit count: 418

Filed under:

I'm looking for help with a php soapclient call:

The call is to a remote panel and I want to pull off the log data. There are various services published via the WSDL and I am able to use several with no issues. Here's the list:

array(12) { 
[0]=> string(77) "GetGPTimerChannelsResponse GetGPTimerChannels(GetGPTimerChannels     $parameters)" 
[1]=> string(74) "GetGPTimerChannelResponse GetGPTimerChannel(GetGPTimerChannel $parameters)" 
[2]=> string(74) "SetGPTimerChannelResponse SetGPTimerChannel(SetGPTimerChannel $parameters)" 
[3]=> string(47) "GetSlaveResponse GetSlave(GetSlave $parameters)" 
[4]=> string(71) "GetLogDataInlineResponse GetLogDataInline(GetLogDataInline $parameters)" 
[5]=> string(71) "GetLogItemInlineResponse GetLogItemInline(GetLogItemInline $parameters)" 
[6]=> string(59) "GetAlarmListResponse GetAlarmList(GetAlarmList $parameters)" 
[7]=> string(50) "GetSyslogResponse GetSyslog(GetSyslog $parameters)" 
[8]=> string(47) "SetSlaveResponse SetSlave(SetSlave $parameters)" 
[9]=> string(53) "GetVersionResponse GetVersion(GetVersion $parameters)" 
[10]=> string(53) "GetTDBInfoResponse GetTDBInfo(GetTDBInfo $parameters)" 
[11]=> string(53) "GetLogItemResponse GetLogItem(GetLogItem $parameters)" } 

I am trying to use the GetLogDataInline service which requires four parameters - these I'm passing as an array and all seems OK when doing the connection (the request/response takes around 30 seconds to process).

When I look at a var_dump / print_r of the result, it returns NULL, whereas when I do a call to the __getLastResponse all of the data I need to populate my local database is there.

Below is the code for the soapclient call:

$client = new soapclient ("http://192.168.1.126/cgi-bin/cgi.cgi?WSDL", 
array("trace" => 1,
"exceptions" => true,
"cache_wsdl" => WSDL_CACHE_NONE,
"features" => SOAP_SINGLE_ELEMENT_ARRAYS
));
$params = array (
        "ResponseType" => "Xml",
        "Step" => 15,
        "Start" => "2012-06-14T12:00:00+01:00",
        "End" => "2012-06-14T23:59:45+01:00"
);  
$result = $client -> GetLogDataInline ($params);

An extract from the var_dump / __getLastResponse is:

  1. var_dump($client)

    object(SoapClient)#1 (4) { ["trace"]=> int(1) ["_features"]=> int(1) ["_soap_version"]=> int(1) ["sdl"]=> resource(4) of type (Unknown) }

  2. var_dump($result)

    NULL

  3. __getLastResponse


    15 2012-06-14T12:00:00+01:00 2012-06-14T23:59:45+01:00 External Temperature Workshop Lux Level Electricity Pulse 100wh Workshop PIR Active Boiler Flow Temp Outside Lux Workshop_Light_Override_Hours Water Consumption (Litres) Electricity kWh Consumption Water Consumption M3 Gas kWh Consumption Outside Lighting Heating Effective Setpoint Router Reset Workshop Lighting State Heating Run Hours Heating On Receptin Percent RH Reception Temp Reception RH Reception Temp 2012-06-14T12:00:00+01:00 -85.6 2.1 -1.0 Off -91.5 13.8 0.0 -1.0 0.0 0.0 -0.1 Off 21.0 Off Off 0.0 Off 53.0 22.0 53.0 22.0 2012-06-14T12:00:15+01:00 -85.4 2.1 -1.0 Off -91.8 13.8 0.0 -1.0 0.0 0.0 -0.1 Off 21.0 Off Off 0.0 Off 53.0 22.0 53.0 22.0 2012-06-14T12:00:30+01:00 -85.4 2.1 -1.0 Off -91.8 13.8 0.0 -1.0 0.0 0.0 -0.1 Off 21.0 Off Off 0.0 Off 53.0 22.0 53.0 22.0 2012-06-14T12:00:45+01:00 -85.4 2.1 -1.0 Off -91.5 13.7 0.0 -1.0 0.0 0.0 -0.1 Off 21.0 Off Off 0.0 Off 54.0 22.0 54.0 22.0

(this should be xml but doesn't appear to have copied correctly)

If you've got this far, thanks for taking the time.

Any help would be much appreciated.

© Stack Overflow or respective owner

Related posts about php