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>.....
有人有任何建议吗?
预先非常感谢
I would like to send a soap response which is pure xml i.e without a soap envelope. This is my current response
<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>......
However, this is the response I would like to send
<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>.....
Does anyone have any suggestions?
Many thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SOAP 是一种协议,因此定义了通信格式(其中包括由以下内容组成的消息)
信封
、正文
和可选的标题
)。如果您只是发回没有
信封
的响应,那么您就违反了协议。您的客户端(期望格式正确的 SOAP 响应)将会失败。如果您使用 SOAP Web 服务,那么您必须发送
信封
。如果这对您来说很麻烦并且您只对有效负载感兴趣,那么也许RESTful Web 服务 会比 SOAP 更合适吗? 您可以根据自己的具体情况来决定。
SOAP is a protocol and as such defines the format of communication (which includes a message composed of an
Envelope
,Body
and optionalHeader
).If you just send the response back with no
Envelope
, you are breaking the protocol. Your clients (who are expecting a properly formatted SOAP response) will fail.If you use a SOAP web service then you must send the
Envelope
.If this is cumbersome for you and you are only interested in the payload, then maybe a RESTful web service would be more appropriate instead of a SOAP one? It is for you to decide given your particular situation.