簡體   English   中英

如何在PHP中使用SoapClient構造SOAP標頭

[英]How to construct SOAP header using SoapClient in PHP

我需要進行肥皂呼叫,包括如下標題:

<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>

如何使用SoapClient在PHP中做到這一點? 請幫助:)

我做的:

$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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM