正在嘗試調用API。我需要的XML如下。在SOAP調用中具有相同名稱的多個節點
<SOAP-ENV:Envelope xmlns:ns1="http://www.webserviceX.NET/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<ns1:ConversionRate/>
<param1>
<MessageTitle>Some Title</MessageTitle>
<Images>
<Image>http://3.bp.blogspot.com/-gzGWCfqJr_k/T-B7L0wlwSI/AAAAAAAADkw/C7sznAKVktc/s1600/rose_flower_screensaver-234027-1240456558.jpeg</Image>
<Image>http://img.ehowcdn.com/article-new-thumbnail/ehow/images/a07/tv/vu/object-property-names-array-php-800x800.jpg</Image>
</Images>
</param1>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
我想在標籤中傳遞多個圖像。但我只能通過一個項目。在PHP多維數組不支持相同的密鑰。我的PHP代碼
$client = new SoapClient('http://www.webservicex.com/CurrencyConvertor.asmx?wsdl', array( 'trace' => true, 'exceptions' => true,'soap_version' => SOAP_1_1));
try {
$data_params = new stdClass();
$imgs = new stdClass();
$img1 = 'http://3.bp.blogspot.com/-gzGWCfqJr_k/T-B7L0wlwSI/AAAAAAAADkw/C7sznAKVktc/s1600/rose_flower_screensaver-234027-1240456558.jpeg';
$img2 = 'http://img.ehowcdn.com/article-new-thumbnail/ehow/images/a07/tv/vu/object-property-names-array-php-800x800.jpg';
$imgs->Image = $img1;
$data_params->MessageTitle = 'Some Title';
$data_params->Images = $imgs;
$params = array( 'Id' => '187',
'Data'=>$data_params);
$result = $client->__soapCall('ConversionRate',$params);
echo $client->__getLastRequest();
}catch(SoapFault $exception)
{
var_dump($exception);
echo $client->__getLastRequest();
}
你必須在這裏混淆了web服務,沒有這樣的參數圖像網址 - 看到我的答案:http://stackoverflow.com/a/19745107/367456它只是工作。 – hakre