SoapServer发送没有信封的响应

时间:2012-01-25 16:23:17

标签: 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>......

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

<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>.....

有人有任何建议吗?

非常感谢提前

1 个答案:

答案 0 :(得分:7)

SOAP是一种协议,因此定义了通信格式(包括由EnvelopeBody和可选Header组成的消息。

如果你只是发回没有Envelope的回复,那么你就违反了协议。您的客户(期望格式正确的SOAP响应)将失败。

如果您使用SOAP网络服务,则必须发送Envelope

如果这对您来说很麻烦,并且您只对有效负载感兴趣,那么可能RESTful web service更合适而不是SOAP? It is for you to decide given your particular situation

相关问题