Hi All
I'm just starting to try and cope with soap, and was getting on ok, until I realised that the SOAP request needed elements of the same name, which associative arrays obviously don't like.
example [cut-down abit, but you should get the idea]:
This is a simple soap request, nice:
<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Body>
<QASearch xmlns="http://www.qas.com/web-2005-10">
<Country>GBN</Country>
<Engine Flatten="true" PromptSet="Default">Singleline</Engine>
<Layout>experian</Layout>
<Search type="First">sw40ql</Search>
</QASearch>
</soapenv:Body>
which I can construct using:
$do_search = array(
'Country' => 'GBR',
'Engine' => array ('' => 'Singleline', 'Flatten' => true, 'PromptSet' => 'Default'),
'Layout' => 'experian',
'Search' => array ('' => 'sw40ql', type => 'First');
and call:
$response_DoSearch = $client-> DoSearch($do_search);
ALL WORKS FINE, I GET A RESPONSE.
However,
If the SOAP request requires elements of the same name, like the Search element:
<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Body>
<QASearch xmlns="http://www.qas.com/web-2005-10">
<Country>GBN</Country>
<Engine Flatten="true" PromptSet="Default">Singleline</Engine>
<Layout>experian</Layout>
<Search type="First">sw40ql</Search>
<Search type="Second">sw41ql</Search>
<Search type="Third">sw42ql</Search>
<Search type="Fourth">sw43ql</Search>
<Search type="Fifth">sw44ql</Search>
</QASearch>
</soapenv:Body>
I am at a loss how to construct this.
I've tried:
$do_search = array(
'Country' => 'GBR',
'Engine' => array ('' => 'Singleline', 'Flatten' => true, 'PromptSet' => 'Default'),
'Layout' => 'experian',
new SoapParam(array('type' => 'first','' => 'sw40ql'),'Search'),
new SoapParam(array('type' => 'second','' => 'sw41ql'),'SearchTerm'),
new SoapParam(array('type' => 'third','' => 'sw42ql'),'SearchTerm'),
new SoapParam(array('type' => 'fourth','' => 'sw43ql'),'SearchTerm'),
new SoapParam(array('type' => 'fifth','' => 'sw44ql'),'SearchTerm'));
which, using print_r, constructs the following [but the server doesn't like the contstruction]. I tried using new soapvar too, but not sure you can add attributes.
Array (
[Country] => GBR
[Engine] => Array ( [_] => Singleline [Flatten] => 1 [PromptSet] => Default)
[Layout] => experian
[0] => SoapParam Object (
[param_name] => Search
[param_data] => Array ( [_] => sw40ql [Key] => first))
[1] => SoapParam Object (
[param_name] => Search
[param_data] => Array ( [_] => sw41ql [Key] => second))
[2] => SoapParam Object (
[param_name] => Search
[param_data] => Array ( [_] => sw42ql [Key] =>third))
[3] => SoapParam Object (
[param_name] => Search
[param_data] => Array ( [_] => sw43ql [Key] => fourth))
[4] => SoapParam Object (
[param_name] => Search
[param_data] => Array ( [_] => sw44ql [Key] => fifth))
)
Any ideas on how else to approach this ??
HELP!
Thanks