我试图连接到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。