Custom header using PHP soap functions
Posted
by Dees
on Stack Overflow
See other posts from Stack Overflow
or by Dees
Published on 2010-03-26T14:02:51Z
Indexed on
2010/03/27
1:13 UTC
Read the original article
Hit count: 400
Hi,
I am having a problem getting a custom soap header to work with PHP5. Can anybody guide me please.
What I require is something like this
<SOAP-ENV:Header>
<USER>myusername</USER>
<PASSWORD>mypassword</PASSWORD>
</SOAP-ENV:Header>
What I get is :
<SOAP-ENV:Header>
<ns2:null>
<USER>myusername</USER>
<PASSWORD>mypassword</PASSWORD>
</ns2:null>
</SOAP-ENV:Header>
I would like to remove the namespace tags. The code I use to get this is:
class Authstuff {
public $USER;
public $PASSWORD;
public function __construct($user, $pass) {
$this->USER = $user;
$this->PASSWORD = $pass;
}
}
$auth = new Authstuff('myusername', 'mypassword');
$param = array('Authstuff' => $auth);
$authvalues = new SoapVar($auth,SOAP_ENC_OBJECT);
$header = new SoapHeader('http://soapinterop.org/echoheader/',"null",$authvalues);
© Stack Overflow or respective owner