I know this question has been asked several times. I spent several hours reading and testing the proposed solutions, but no one works for my situation.
I need to send a SOAP request to an API, which may contain an element that repeats as follows:
<operationNumbers>
<operationNumber>1234</operationNumber>
<operationNumber>1235</operationNumber>
<operationNumber>1236</operationNumber>
<operationNumber>1237</operationNumber>
</operationNumbers>
I read that maybe I could do this:
$buildRequest = Array(
'myheader' => Array(
'date' => MY_DATE,
'id' => Array(
'client' => CLIENT,
'clientRef' => MYREF
)
),
'operationNumbers' => Array (
Array('operationNumber' => '1234'),
Array('operationNumber' => '1235')
)
);
$request = $client->__soapCall( 'getMultiOpDets', array($buildRequest) );
Unfortunately, this does not work and leads to an “invalid request” if I send one operation number, for example:
...
'operationNumbers' => Array (
'operationNumber' => '1234'
)
...
Request completed successfully. I tried soapVars / soapParams but can't get it working using this approach. Any hints / tips / help appreciated.
source
share