我对肥皂很陌生,我有点不知道该怎么做。提供者的文档是非常有限的,所以这只是一个小的尝试和错误,因为他们不提供支持。文档指出,XML应该从以下内容开始--然后我假设它们是指标题。
POST /Economy/InvoiceOrder/V001/InvoiceService.asmx HTTP/1.1
Host: api.url.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://url.com/webservices/GetDeliveryMethods"我尝试以下列方式设置标题:
$header = new SoapHeader(
"POST /Economy/InvoiceOrder/V001/InvoiceService.asmx HTTP/1.1",
"Host: api.url.com",
"Content-type: text/xml;charset='utf-8'",
"Content-length: ".strlen($xmlfinal),
"SOAPAction: http://url.com/webservices/GetDeliveryMethods"
);
$invoiceService->__setSoapHeaders($header);但是,请求返回为“坏请求”。根据提供程序示例,我的XML看起来很好。
XML既作为服务器上的文件创建,又存储在$xmlfinal中。
有人知道我可能做错了什么吗?我很感激你能提供的任何帮助。
发布于 2017-01-24 11:52:47
"SoapHeader“出现在<header>元素中。这可能不是你想要的。
您可以在流上下文中设置标头并将其传递给soap客户端。
$opts = array(
'http' => array(
'header' => 'YourHeader: value'
),
);
$ctx = stream_context_create($opts);
$client = new SoapClient('the.wsdl', array('stream_context' => $ctx));https://stackoverflow.com/questions/41826724
复制相似问题