我正在尝试通过SOAP发送请求,并调用服务功能。我有WSDL文件,该文件返回可用函数。这是我的代码示例:
ini_set('display_errors', '1');
ini_set('error_reporting', E_ALL &~ (E_NOTICE | E_STRICT));
ini_set("soap.wsdl_cache_enabled", 0);
$wsdl = 'source/HPSMInteractionsFromMosRu.wsdl';
$client = new SoapClient($wsdl,
array(
'trace' => 1,
'exception' => 0
));
$res = $client->RetrieveHPSMInteractionsFromMosRuKeysList(array(
'Portal' => 'Portal_example',
'CK' => 'CK_example'
));
print_r($res);
那给我返回一个错误:
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no 'model' property in *my_path* Stack trace: #0 *my_path* (24): SoapClient->__soapCall('RetrieveHPSMInt...', Array) #1 {main} thrown in *my_path* on line 24
同时,如果我尝试使用相同的WSDL文件通过SoapUI程序来执行该请求,则将发出该XML请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://schemas.hp.com/SM/7" xmlns:com="http://schemas.hp.com/SM/7/Common" xmlns:xm="http://www.w3.org/2005/05/xmlmime">
<soapenv:Header/>
<soapenv:Body>
<ns:RetrieveHPSMInteractionsFromMosRuKeysListRequest>
<ns:model>
<ns:keys>
<ns:ID></ns:ID>
</ns:keys>
<ns:instance>
<ns:Portal>Portal_example</ns:Portal>
<ns:CK>CK_example</ns:CK>
</ns:instance>
</ns:model>
</ns:RetrieveHPSMInteractionsFromMosRuKeysListRequest>
</soapenv:Body>
</soapenv:Envelope>
我是SOAP的新手。但是据我了解,我必须使用XML参数和关联数组来调用函数。
我只使用少量的SOAP,但是因为它提到缺少“模型”,所以我认为您的请求应如下所示:
$res = $client->RetrieveHPSMInteractionsFromMosRuKeysList(array(
'model' => array(
'keys' => array(
'ID' => ''
),
'instance' => array(
'Portal' => 'Portal_example',
'CK' => 'CK_example'
),
),
));
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句