SoapServer发送没有信封的响应 [英] SoapServer send response without envelope
问题描述
我想发送一个纯XML的肥皂响应,即没有肥皂信封.这是我目前的回复
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>.....
有人有什么建议吗?
非常感谢
推荐答案
SOAP 是协议,并因此定义了通信格式(其中包括由Envelope
,Body
和可选的Header
组成的消息).
SOAP is a protocol and as such defines the format of communication (which includes a message composed of an Envelope
, Body
and optional Header
).
如果只发送不带Envelope
的响应,则表明您违反了协议.您的客户端(期望正确格式化SOAP响应的客户端)将失败.
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.
如果您使用SOAP Web服务,则必须发送Envelope
.
If you use a SOAP web service then you must send the Envelope
.
如果这对您来说很麻烦,并且您仅对有效负载感兴趣,那么也许 RESTful Web服务比使用SOAP服务更合适? 您可以根据自己的具体情况来决定.
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.
这篇关于SoapServer发送没有信封的响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!