开发者

PHP SOAP Request includes multiple identical tags

OK, so I have this external SOAP based webservice, and PHP SoapClient. Everything is fine with basic requests, but I need to create a parameter set that looks like this:

<DatasetList>
  <DatasetID>K0001</DatasetID>
  <DatasetID>K0002</DatasetID>
</DatasetList>

For a single nested DatasetID tag I'd do:

$req = array( "DatasetList" => array( "DatasetId" => "K0001" ));
$client->getWebserviceCall($req);

but I need multiple DatasetID tags... I've tried assigning DatasetID as an array, but I just get:

<DatasetList>
  <DatasetID>Array</Data开发者_运维技巧setID>
</DatasetList>

Anyone help?


Did you try the array this way?

$req = array( "DatasetList" => array("DatasetID" => array("K0001", "K0002));


You can do this only by wrote the Part with the identical tags by hand. But, the rest of values can you define in a array:

// Define multiple identical Tags for a part of the Array
$soap_var= new SoapVar('
  <DatasetID>1</DatasetID>
  <DatasetID>2</DatasetID>
';

// Define the other Values in the normal Way as an array
$req = array( 
  "DatasetList" => $soap_var,
  'value2'=>array('other'=>'values'
);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜