[英]How to construct SOAP header using SoapClient in PHP
I need to make soap calls which include headers like this: 我需要进行肥皂呼叫,包括如下标题:
<soap:Header>
<Agency xmlns="http://schemas.costacrociere.com/WebAffiliation">
<Code>1111</Code>
<Culture />
</Agency>
<Partner xmlns="http://schemas.costacrociere.com/WebAffiliation">
<Name>AAAA</Name>
<Password>XXXX</Password>
</Partner>
</soap:Header>
How to do that in PHP using SoapClient? 如何使用SoapClient在PHP中做到这一点? Plz help :)
请帮助:)
I did it: 我做的:
$ns="http://schemas.costacrociere.com/WebAffiliation";
//Body of the Soap Header.
$headerbody1 = array("Name" => "AAAA", "Password" => "XXXX");
$headerbody2 = array("Code" => "1111");
//Create Soap Header.
$header[] = new SOAPHeader($ns, 'Partner', $headerbody1);
$header[] = new SOAPHeader($ns, 'Agency', $headerbody2);
//set the Headers of Soap Client.
$client->__setSoapHeaders($header);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.