Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Soap Header help

I have a fairly simple php/soap header question.

Here's what I need.

<ns1:Identity token="123456789"></ns1:Identity>

Here's what I get...

<ns1:Identity><item><key>token</key><value>123456789</value></item></ns1:Identity>

using this code...

$headers[] = new SoapHeader('http://qpricer.com/Services/Pricing','Identity',array('token'=> '123456789'));
$client->__setSoapHeaders($headers);

Using soapui, I have narrowed my issue down to this right here.

How do I go from the second one to the first one?

An help would be greatly appreciated, thanks for your time.

like image 738
Xavias Avatar asked Aug 09 '10 14:08

Xavias


Video Answer


1 Answers

Because this was the only header I had to set, I was able to fix it using the following code.

$headers[] = new SoapHeader('http://www.qpricer.com/Services/Pricing','Identity token="123456789"',null);

This produced the following XML

<ns1:Identity token="123456789"/>

and it worked!

like image 131
Xavias Avatar answered Nov 14 '22 23:11

Xavias