SoapServer 发送不带信封的响应

发布于 2024-12-29 07:55:28 字数 699 浏览 1 评论 0原文

我想发送一个纯 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

街角卖回忆 2025-01-05 07:55:28

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 optional Header).

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文