RE: [SOAP] webservice.php and header
| From: | Mike Carter | Date: | Wed, 03 Dec 2003 10:48:20 +0000 |
| Subject: | RE: [SOAP] webservice.php and header | ||
| References: | 1 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-1195@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: PHPDiscuss - PHP Newsgroups and mailing lists
>
> hi, i am using the following code to connect to web-service,
> but i fail to
> connect cause of i cannt set header.
> how can i set header?
> ( the lines i wrote with $k->header simply dont work, the xml that is
> sending to the server without header at all)
> <?php
> require_once("webservice.php");
> $k = WebService::ServiceProxy("address.asmx?WSDL");
> $par=array('id'=>111,'desc'=>'blabla');
> $headers = '<LoginHeader xmlns="aaa">' .
> '<username xmlns="aaa" >222</username> <password
> xmlns="bb">111</password></LoginHeader>';
> $k->header=$headers;
> $res = $k->call("procedure",array($par),"kk","hhh");
> ?>
I add a header containing a GUID to identifiy a logged in user.
Experiment with some code similar to this:-
$ourHeader = new SOAP_Header('TokenHeader', 'Struct',
array('InnerToken' =>
$this->userToken), false);
$ourHeader->attributes['<name>'] = <value>;
$this->addHeader($ourHeader);
Regards,
Mike C
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________