2012-04-04 72 views
0

我試圖讓從PHP Web服務調用與樣品請求SOAP的Web服務,它看起來是這樣的:如何將SOAP Web服務調用到.NET Web服務,而不是「無法反序列化請求」錯誤?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.somedomain.com/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <ws:SearchMarketplaceSku> 
     <ws:Request> 
      <ws:Security> 
       <ws:PartnerKey>[suppressed]</ws:PartnerKey> 
       <ws:Password>[suppressed]</ws:Password> 
      </ws:Security> 
      <ws:AvailableOnDate>2012-04-03T00:00:00</ws:AvailableOnDate> 
      <ws:IncludeStateDetails>true</ws:IncludeStateDetails> 
      <ws:State>CA</ws:State> 
     </ws:Request> 
     </ws:SearchMarketplaceSku> 
    </soapenv:Body> 
</soapenv:Envelope> 

正在使用的PHP代碼:

$soapClient = new SoapClient($wsdlUrl); 
$ap_param = array('PartnerKey' => $PartnerKey, 'Password' => $metapackPassword, 'AvailableOnDate' => '2012-04-03T00:00:00','IncludeStateDetails'=>true, 'State'=>'CA'); 
$info = $soapClient->__call("SearchMarketplaceSku", $ap_param); 

該網站服務調用導致「請求未被正確指定;服務器無法反序列化請求」錯誤?問題是什麼? $ ap_param數組是否需要包含與XML相關的所有嵌套節點?有沒有更簡單的方法使用「WSDL」模式進行此調用?

感謝您的幫助

回答

2

PartnerKey和密碼必須是一個陣列中的關鍵安全下:

$ap_param = array(
'Security' => array(
    'PartnerKey' => $PartnerKey, 
    'Password' => $metapackPassword 
), 
'AvailableOnDate' => '2012-04-03T00:00:00', 
'IncludeStateDetails'=>true, 'State'=>'CA' 
);