我正在尝试连接到 WebService SOAP。该服务要求我们在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));
这是我的请求标头:
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
我在哪里可以添加自定义参数?
谢谢。