SoapServer发送没有信封的响应

mik*_*art 2 php xml soap soapserver

我想发送一个纯xml肥皂响应,即没有肥皂信封.这是我目前的回应

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">
   <SOAP-ENV:Body>
      <ns1:getMemberResponse>
         <User>
            <ValidationErrors/>
            <IsDeleted>false</IsDeleted>
            <ID>1691</ID>......
Run Code Online (Sandbox Code Playgroud)

但是,这是我想发送的回复

<User xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ValidationErrors />
  <IsDeleted>false</IsDeleted>
  <ID>1691</ID>.....
Run Code Online (Sandbox Code Playgroud)

有没有人有什么建议?

提前谢谢了

Bog*_*dan 7

SOAP是一个协议,因此限定了通信的格式(其包括的编写的消息Envelope,Body和可选的Header).

如果您只是将响应发送回no Envelope,则表明您正在破坏协议.您的客户(期望格式正确的SOAP响应)将失败.

如果您使用SOAP Web服务,则必须发送Envelope.

如果这对您来说很麻烦,并且您只对有效负载感兴趣,那么RESTful Web服务可能更适合而不是SOAP服务吗?根据您的具体情况,您可以自行决定.