Php SOAP调用中具有相同名称的多个节点

Php SOAP调用中具有相同名称的多个节点,php,xml,soap,soap-client,Php,Xml,Soap,Soap Client,我正在尝试调用API。我需要的XML如下 <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 Ti

我正在尝试调用API。我需要的XML如下

<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>
试试像这样的东西

   <Images>
    <Image>
    <item>your Image<item>
    </Image>
    <Image>
    <item>your 2nd Image<item>
    </Image>
    </Images>

你的形象
你的第二张照片

您肯定弄错了什么,CurrencyConvertor webservice ConversionRate方法工作正常,没有任何重复的参数名,只有重复的类型,但这些是字符串,而不是图像URL

以下是工作代码的输出(从欧元到美元的转换率):

以下是工作代码:

<?php
/**
 * Multiple Nodes with same Name in SOAP Call
 * @link http://stackoverflow.com/q/19727338/367456
 */

$wsdl    = 'http://www.webservicex.com/CurrencyConvertor.asmx?wsdl';
$options = array(
    'trace'        => true,
    'exceptions'   => true,
    'soap_version' => SOAP_1_1,
);

$client = new SoapClient($wsdl, $options);

$params = array(
    'FromCurrency' => 'EUR',
    'ToCurrency'   => 'USD',
);

var_dump(
    $client->ConversionRate($params)
);

你必须把这里的Web服务搞混了,这里没有这样的参数图像URL-看看我的答案:它只是工作而已。
class stdClass#2 (1) {
  public $ConversionRateResult =>
  double(1.3488)
}
<?php
/**
 * Multiple Nodes with same Name in SOAP Call
 * @link http://stackoverflow.com/q/19727338/367456
 */

$wsdl    = 'http://www.webservicex.com/CurrencyConvertor.asmx?wsdl';
$options = array(
    'trace'        => true,
    'exceptions'   => true,
    'soap_version' => SOAP_1_1,
);

$client = new SoapClient($wsdl, $options);

$params = array(
    'FromCurrency' => 'EUR',
    'ToCurrency'   => 'USD',
);

var_dump(
    $client->ConversionRate($params)
);