soap headers and webservice

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
neversleep
Forum Newbie
Posts: 4
Joined: Sat Sep 24, 2005 5:35 pm

soap headers and webservice

Post by neversleep »

After days of googling and not getting any answers I turn to this forum hoping for some help. I need to comsume a webservice wich requires special headers in the soap msg with logininformation. My question is, how do I add headers to the msg? I would like to do this with the extension in php5...but if anyone here have better knowledge in nusoap or anything else this would work aswell. Getting desperate here!

Hope someone could lead me on to the right track 8O

regards
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

SoapClient->__soapCall()
SoapHeader is a special low-level class for passing or returning SOAP headers. It's just a data holder and it does not have any special methods except its constructor. It can be used in the SoapClient->__soapCall() method to pass a SOAP header or in a SOAP header handler to return the header in a SOAP response.
neversleep
Forum Newbie
Posts: 4
Joined: Sat Sep 24, 2005 5:35 pm

Post by neversleep »

Thank you Jcart for the reply
I've trying to work with that function shortly but didn't get it to work. The structure in my call is rather complexed and I cant get it to work without wdsl wich cant be used in SoapClient->__soapCall()

I've been experimenting with setSoapHeaders...doing like this:

$userId = new SoapHeader('', 'userId', 'xxx'); //not sure if the first parameter here is important?
$userPassword = new SoapHeader('', 'userPassword', 'xxx');
$client->__setSoapHeaders(array(1 => $userId, 2 => $userPassword));

but I get the response: missing header userid...
neversleep
Forum Newbie
Posts: 4
Joined: Sat Sep 24, 2005 5:35 pm

Post by neversleep »

nevermind...got it to work. The namespaceheader in SoapHeader was important
Post Reply