如何在PHP中使用SoapClient构造SOAP头

如何在PHP中使用SoapClient构造SOAP头,php,web-services,soap,header,Php,Web Services,Soap,Header,我需要进行soap调用,其中包括如下标题: <soap:Header> <Agency xmlns="http://schemas.costacrociere.com/WebAffiliation"> <Code>1111</Code> <Culture /> </Agency> <Partner xmlns="http://schemas.costacrocie

我需要进行soap调用,其中包括如下标题:

<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>
如何在PHP中使用SoapClient实现这一点? Plz帮助:)

我做到了:

$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);
我做到了:

$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);