我正在寻求有关 php soapclient 调用的帮助:
呼叫是远程面板,我想提取日志数据。通过 WSDL 发布了各种服务,我可以毫无问题地使用其中的几个。这是列表:
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)" }
我正在尝试使用需要四个参数的 GetLogDataInline 服务 - 这些我作为数组传递,并且在进行连接时似乎一切正常(请求/响应大约需要 30 秒来处理)。
当我查看结果的 var_dump / print_r 时,它返回 NULL,而当我调用 __getLastResponse 时,我需要填充本地数据库的所有数据都在那里。
下面是soapclient调用的代码:
$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);
var_dump / __getLastResponse 的摘录是:
var_dump($client)
object(SoapClient)#1 (4) { ["trace"]=> int(1) ["_features"]=> int(1) ["_soap_version"]=> int(1) ["sdl"]=> resource(4) of type (Unknown) }
var_dump($result)
NULL
__getLastResponse
<?xml version="1.0" encoding="UTF-8" ?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body> <GetLogDataResponse xmlns="http://url/RDMPlantTDB/2009/03/13/">
<GetLogDataResult>
<Step>15</Step>
<Start>2012-06-14T12:00:00+01:00</Start>
<End>2012-06-14T23:59:45+01:00</End>
<LogData>
<![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
<Data>
<Fields> <Field>External Temperature</Field> <Field>Workshop Lux Level</Field> <Field>Electricity Pulse 100wh</Field> <Field>Workshop PIR Active</Field> <Field>Boiler Flow Temp</Field> <Field>Outside Lux</Field> <Field>Workshop_Light_Override_Hours</Field> <Field>Water Consumption (Litres)</Field> <Field>Electricity kWh Consumption</Field> <Field>Water Consumption M3</Field> <Field>Gas kWh Consumption</Field> <Field>Outside Lighting</Field> <Field>Heating Effective Setpoint</Field> <Field>Router Reset</Field> <Field>Workshop Lighting State</Field> <Field>Heating Run Hours</Field> <Field>Heating On</Field> <Field>Receptin Percent RH</Field> <Field>Reception Temp</Field> <Field>Reception RH</Field> <Field>Reception Temp</Field> </Fields>
<Entries> <Entry> <Time>2012-06-14T12:00:00+01:00</Time> <Values> <Value>-85.6</Value> <Value>2.1</Value> <Value>-1.0</Value> <Value>Off</Value> <Value>-91.5</Value> <Value>13.8</Value> <Value>0.0</Value> <Value>-1.0</Value> <Value>0.0</Value> <Value>0.0</Value> <Value>-0.1</Value> <Value>Off</Value> <Value>21.0</Value> <Value>Off</Value> <Value>Off</Value> <Value>0.0</Value> <Value>Off</Value> <Value>53.0</Value> <Value>22.0</Value> <Value>53.0</Value> <Value>22.0</Value> </Values> </Entry> <Entry> <Time>2012-06-14T12:00:15+01:00</Time> <Values> <Value>-85.4</Value> <Value>2.1</Value> <Value>-1.0</Value> <Value>Off</Value> <Value>-91.8</Value> <Value>13.8</Value> <Value>0.0</Value> <Value>-1.0</Value> <Value>0.0</Value> <Value>0.0</Value> <Value>-0.1</Value> <Value>Off</Value> <Value>21.0</Value> <Value>Off</Value> <Value>Off</Value> <Value>0.0</Value> <Value>Off</Value> <Value>53.0</Value> <Value>22.0</Value> <Value>53.0</Value> <Value>22.0</Value> </Values> </Entry> <Entry> <Time>2012-06-14T12:00:30+01:00</Time> <Values> <Value>-85.4</Value> <Value>2.1</Value> <Value>-1.0</Value> <Value>Off</Value> <Value>-91.8</Value> <Value>13.8</Value> <Value>0.0</Value> <Value>-1.0</Value> <Value>0.0</Value> <Value>0.0</Value> <Value>-0.1</Value> <Value>Off</Value> <Value>21.0</Value> <Value>Off</Value> <Value>Off</Value> <Value>0.0</Value> <Value>Off</Value> <Value>53.0</Value> <Value>22.0</Value> <Value>53.0</Value> <Value>22.0</Value> </Values> </Entry> <Entry> <Time>2012-06-14T12:00:45+01:00</Time> <Values> <Value>-85.4</Value> <Value>2.1</Value> <Value>-1.0</Value> <Value>Off</Value> <Value>-91.5</Value> <Value>13.7</Value> <Value>0.0</Value> <Value>-1.0</Value> <Value>0.0</Value> <Value>0.0</Value> <Value>-0.1</Value> <Value>Off</Value> <Value>21.0</Value> <Value>Off</Value> <Value>Off</Value> <Value>0.0</Value> <Value>Off</Value> <Value>54.0</Value> <Value>22.0</Value> <Value>54.0</Value> <Value>22.0</Value> </Values> </Entry> <Entry>