note 93460 modified in soapclient.setsoapheaders by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 Sep 2009 20:01:03 +0000 |
| Subject: | note 93460 modified in soapclient.setsoapheaders by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160438@lists.php.net to get a copy of this message | ||
To create complex SOAP Headers, you can do something like this:
Required SOAP Header:
<soap:Header>
<RequestorCredentials xmlns="http://namespace.example.com/">
<Token>string</Token>
<Version>string</Version>
<MerchantID>string</MerchantID>
<UserCredentials>
<UserID>string</UserID>
<Password>string</Password>
</UserCredentials>
</RequestorCredentials>
</soap:Header>
Corresponding PHP code:
<?php
$ns = 'http://namespace.example.com/';
//Namespace of the WS.
//Body of the Soap Header.
$headerbody = array('Token' => $someToken,
'Version' => $someVersion,
'MerchantID'=>$someMerchantId,
'UserCredentials'=>array('UserID'=>$UserID,
'Password'=>$Pwd));
//Create Soap Header.
$header = new SOAPHeader($ns, 'RequestorCredentials', $headerbody);
//set the Headers of Soap Client.
$soap_client->__setSoapHeaders($header);
?>
--was--
To create complex SOAP Headers, you can do something like this:
Required SOAP Header:
<soap:Header>
<RequestorCredentials xmlns="http://url.for.the.namespace/">
<Token>string</Token>
<Version>string</Version>
<MerchantID>string</MerchantID>
<UserCredentials>
<UserID>string</UserID>
<Password>string</Password>
</UserCredentials>
</RequestorCredentials>
</soap:Header>
Corresponding PHP code:
<?php
$ns = 'http://url.for.the.namespace/';
//Namespace of the WS.
//Body of the Soap Header.
$headerbody = array('Token' => $someToken,
'Version' => $someVersion,
'MerchantID'=>$someMerchantId,
'UserCredentials'=>array('UserID'=>$UserID,
'Password'=>$Pwd));
//Create Soap Header.
$header = new SOAPHeader($ns, 'RequestorCredentials', $headerbody);
//set the Headers of Soap Client.
$soap_client->__setSoapHeaders($header);
?>
http://php.net/manual/en/soapclient.setsoapheaders.php