簡體   English   中英

SOAP WSDL php請求

[英]SOAP WSDL php request

我正在嘗試通過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'
        ),
    ),
));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM