使用PHP访问SOAP Web服务,需要一个空白的Header


SOAP Web Service accessing with PHP, need a blank Header

这是我使用SoapClient PHP类生成的内容。

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:sap-com:document:sap:soap:functions:mc-style">
 <SOAP-ENV:Body>
  <ns1:_-bic_-nf2>
   <ETColumnDescription/>
   <ETGridData/>
   <ETMessageLog/>
   <ETRowDescription/>
   <ISVar_01xwerbet>
    <Sign>I</Sign>
    <Option>LE</Option>
    <Low>3</Low>
    <High/>
   </ISVar_01xwerbet>
  </ns1:_-bic_-nf2>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

我还需要一个看起来像<SOAP-ENV:Header/>
的空白标题就在<SOAP-ENV:Body> 之前

但是使用SOAPHeader:$header = new SOAPHeader('urn:sap-com:document:sap:soap:functions:mc-style',null,null)似乎不起作用。什么都试过了。还有其他想法吗?

我还需要的是,在发送请求之前删除第一行<?xml version="1.0" encoding="UTF-8"?>,我认为服务器不喜欢它,这可能吗?

如果有帮助的话,这是针对SAP Web服务的。

提前谢谢。

这是可能的。只需参考库中的nusoap.php文件即可。您可以修改通常出现在变量$headers下的标头。我试过了,它对我有效。