繁体   English   中英

使用SOAP调用Webservice方法时出错

[英]Error Calling Webservice Method Using SOAP

关于SOAP,我是个菜鸟。 我正在尝试发出SOAP请求。 它可以一直工作到我到达特定的方法,然后失败并显示以下消息: SOAP错误:编码:对象没有'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>

因此,我想我不了解Web服务的设置方式。 据我了解,此OTSWebSvcs Web服务具有dequeue2方法,该方法接受两个参数SubscriberId和transactionIdIn。 显然,我缺少了一些东西。 任何帮助将不胜感激。

您的脚本中有错别字:

$result = $client->dequeue2(array('subscriberId'=> "1", 'transactionId' => "0"));

它应该是 :

$result = $client->dequeue2(array('subscriberId'=> "1", 'transactionIdIn' => "0"));

正如肥皂错误告诉您的。 试试看,让我知道它现在是否适合您:-)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM