对于SOAP,我是一个noobie。我正在尝试发出SOAP请求。它一直有效,直到我找到一个特定的方法,然后失败并显示以下消息: SOAP-ERROR:编码:对象没有'transactionIdIn'属性
这是我的代码:
error_reporting(-1);
ini_set("soap.wsdl_cache_enabled", "0");
//Set up client; username and password replaced for security
try {
$client = new SoapClient('https://services.omnitracs.com/otsWebWS/services/OTSWebSvcs/wsdl/OTSWebSvcs.wsdl',
array('Username'=> {username},
'Password' => {password}));
}
catch (Exception $e) {
echo $e->getMessage();
}
//Call dequeue2 method
try {
$result = $client->dequeue2(array('subscriberId'=> "1", 'transactionId' => "0"));
}
catch (Exception $e) {
echo $e->getMessage();
}
这是我打电话给的wsdl:https://services.omnitracs.com/otsWebWS/services/OTSWebSvcs/wsdl/OTSWebSvcs.wsdl
以下是我正在查看的wsdl的相关部分:
xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://websvcs.otswebws">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://websvcs.otswebws">
<import namespace="http://datatype.otswebws"/>
<element name="dequeueResponse">...</element>
<element name="getSubscriberInfo">...</element>
<element name="getSubscriberInfoResponse">...</element>
<element name="dequeue2">
<complexType>
<sequence>
<element name="subscriberId" type="xsd:int"/>
<element name="transactionIdIn" type="xsd:long"/>
</sequence>
</complexType>
</element>
<wsdl:portType name="OTSWebSvcs">
<wsdl:operation name="dequeue">...</wsdl:operation>
<wsdl:operation name="getSubscriberInfo">...</wsdl:operation>
<wsdl:operation name="dequeue2">
<wsdl:input message="impl:dequeue2Request" name="dequeue2Request"></wsdl:input>
<wsdl:output message="impl:dequeue2Response" name="dequeue2Response"></wsdl:output>
<wsdl:fault message="impl:WSException" name="WSException"></wsdl:fault>
</wsdl:operation>
</wsdl:portType>
所以,我想我不了解网络服务的设置方式。据我所知,这个OTSWebSvcs webservice有一个dequeue2方法,它接受两个参数,subscriberId和transactionIdIn。显然,我错过了一些东西。任何帮助将不胜感激。
答案 0 :(得分:0)
您的脚本中有拼写错误:
$result = $client->dequeue2(array('subscriberId'=> "1", 'transactionId' => "0"));
应该是:
$result = $client->dequeue2(array('subscriberId'=> "1", 'transactionIdIn' => "0"));
正如肥皂错误告诉你的那样。尝试一下,让我知道它现在是否适合你: - )