PHP Soap Header Helper

I have a pretty simple question with the php / soap header.

This is what I need.

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

Here is 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 narrowed my problem down to this right here.

How to go from second to first?

Help will be greatly appreciated for your time.

+6
soap php soap-client soapheader nusoap
source share
1 answer

Since 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 created the following XML

 <ns1:Identity token="123456789"/> 

and it worked!

+2
source share

All Articles