我試圖連接到WebService SOAP。 服務要求我們在SOAP調用使用PHP在調用soap中添加自定義HTTP標頭
$context = array('http' =>
array(
'header' => "APIToken: $api_token\r\n"
)
);
$soap_options = array(
'stream_context' => stream_context_create($context),
'encoding' => 'UTF-8',
'exceptions' => TRUE,
'trace' => true,
'local_cert' => 'mycert.pem',
'passphrase'=>'xxx',
'location'=>$this->url_soap_dev
);
$soap_client = new SoapClient('soap.wsdl', $soap_options);
$args = array(
'param1' => $var,
'param2' => 0,
'optionalParameters'=>array()
);
$ret = $soap_client->RemoteFunction(array('parameter'=>$args));
的HTTP標頭添加自定義的參數,這是我的請求報頭:
POST /server/soap HTTP/1.1
Host: domain.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.2.6-1+lenny16
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 400
我在哪裏可以添加自定義PARAM?
Thx。