By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,728 Members | 2,488 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,728 IT Pros & Developers. It's quick & easy.

PHP 5 soap and XML custom soap header

P: n/a
I am having a problem getting a custom soap header to work with PHP5.
What I require is something like this:

What I get is :

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
I have tried several other ways to do this but to no avail, using a
"null" in the namespace field returns an error.
Any help on how to do this would be great. Also could anyone recommend
a programmer for hire to help out on these problems as I will be having
quite a few in the comming weeks, not on a full time basis but to help
out with this type of question(s).


Sep 15 '05 #1
Share this Question
Share on Google+
4 Replies

P: n/a
Did you modify the envelope? Your reference to the namespace brings up
a page (with tons of popups) and not your namespace.

Did you try

new SoapClient(null,


new SoapClient("null",

The first one is the correct one.

Sep 15 '05 #2

P: n/a
That should have been "Your reference to the envelope" :)

Sep 15 '05 #3

P: n/a
I thank you for your reply, Sorry about the popup page, not sure how
that got in there.
I am currently using the following:
$param = array('Authstuff' => $auth);
$auth = new authstuff('myuser','mypassword');
$authvalues=new SoapVar($auth,SOAP_ENC_OBJECT);
$header = new

$client = new SoapClient(null,
"location" => "http://localhost:8181/devserv",
"uri" => "",
"style" => SOAP_RPC,
and getting:
<PASSWORD> mypassword</PASSWORD>

Any idea how to get rid of the ":notneeded" parts, if I put them as
null I get:
Fatal error: SoapHeader::__construct(): Invalid parameters. Invalid
header name.

any help appreciated

Sep 16 '05 #4

P: n/a
hmmm, null has worked for me in the past. My current host doesn't have
soap so.....

Maybe the following will work

SoapHeader("", ,$authvalues)

Sep 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.