0
我正在用下面的代碼SOAP請求:如何使用Zend_Soap_Client進行正確的請求?
$client = new Zend_Soap_Client($ws_url);
$reqFilter = array();
$reqFilter['CustomTemplateId'] = 33117;
$reqFilter['StartDate'] = '2011-11-01T00:00:00';
$reqFilter['EndDate'] = '2011-11-01T00:00:00';
$secArr = Array();
$secArr['Key'] = '----------';
$secArr['UserName'] = 'joe';
$secArr['Password'] = '----------';
try{
$result = $client->RequestCustomReport(array('reportDefinition'=>$reqFilter),array('securityCredentials'=>$secArr));
}
catch(Exception $e){
echo 'bad times';
echo $client->getLastRequest().'<hr>';
echo $e;
}
它產生這種實際的SOAP請求:
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://api.dc-storm.com/broker/engage/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<ns1:RequestCustomReport>
<ns1:reportDefinition>
<ns1:CustomTemplateId>33117</ns1:CustomTemplateId>
<ns1:StartDate>2011-11-01T00:00:00</ns1:StartDate>
<ns1:EndDate>2011-11-01T00:00:00</ns1:EndDate>
</ns1:reportDefinition>
<param1>
<item>
<key>securityCredentials</key>
<value>
<item>
<key>Key</key>
<value>--------------</value>
</item>
<item>
<key>UserName</key>
<value>joe</value>
</item>
<item>
<key>Password</key>
<value>-------------</value>
</item>
</value>
</item>
</param1>
</ns1:RequestCustomReport>
</env:Body>
</env:Envelope>
這種比較應該是什麼要求:
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://api.dc-storm.com/broker/engage/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<ns1:RequestCustomReport>
<ns1:reportDefinition>
<ns1:CustomTemplateId>33117</ns1:CustomTemplateId>
<ns1:StartDate>2011-11-01T00:00:00</ns1:StartDate>
<ns1:EndDate>2011-11-01T00:00:00</ns1:EndDate>
</ns1:reportDefinition>
<ns1:securityCredentials>
<ns1:Key>--------------------</ns1:Key>
<ns1:UserName>joe</ns1:UserName>
<ns1:Password>--------------------</ns1:Password>
</ns1:securityCredentials>
</ns1:RequestCustomReport>
</env:Body>
</env:Envelope>
的問題是格式不正確的「securityCredentials」節點。我不明白的是事實「reportDefinition」是正確的,但爲什麼不是「securityCredentials」。我傳遞的參數「securityCredentials」和「reportDefinition」以同樣的方式進入肥皂的方法和期望從分析WSDL創建的結構。
我檢查的WSDL和securityCredentials的定義是當前和方法參數鏈接的方式reportDefinition相同。
有什麼我失蹤了嗎?