gSOAP 客户端的 WCF 服务

发布于 2024-12-15 16:53:50 字数 928 浏览 1 评论 0原文

我收到了构建服务来处理来自预先设计的客户端的流量的请求。

文档指出该服务是 SOAP 服务,但我后来发现预先设计的客户端使用的协议是使用 SOAP 1.2 的 gSOAP

我得到的问题是,当将 Binding 分配给 basicHttpBinding 时,我得到的错误Action '' not support,因为客户端不发送 SOAPAction 标头(因为 SOAP 1.2 中未使用它),并且如果我设置了我的绑定使用 wsHttpBinfing 的 WCF 服务我收到错误

HTTP/1.1 415 
Cannot process the message because the content type 'text/xml; charset=utf-8' 
was not the expected type 'application/soap+xml; charset=utf-8'.

所以基本上看来他们使用的 gSOAP 客户端发送 SOAP 1.2 的 SOAP 结构,但使用 SOAP 1.1 的 Content-Type

我的问题是如何获取我的WCF 服务处理来自客户端的请求。 (客户端不能以任何方式修改)

我尝试使用各种 messageVersion 值设置 customBinding

<customBinding>
    <binding name="myCustomBinding">
      <textMessageEncoding messageVersion="Soap12" />
      <httpTransport/>
    </binding>
</customBinding>

。但我还没有找到有效的组合。

I have received a request to build a Service to handle trafic from a predesigned client.

The documentation stated the service is a SOAP service but I later found out the protocol used by the predesigned client is gSOAP using SOAP 1.2

The issue I get is that when assigning the Binding to basicHttpBinding the error I get i Action '' not supported, since the client does not send the SOAPAction header (as it is not used in SOAP 1.2) and if I set the binding of my WCF service with wsHttpBinfing I get the error

HTTP/1.1 415 
Cannot process the message because the content type 'text/xml; charset=utf-8' 
was not the expected type 'application/soap+xml; charset=utf-8'.

So basicly it seems he gSOAP client they use sends the SOAP structure of SOAP 1.2 but with the Content-Type of SOAP 1.1

My question in this is how do I get my WCF service to handle the requests from the client.
(The client cannot be modified in any way)

I have tried setting up a customBinding

<customBinding>
    <binding name="myCustomBinding">
      <textMessageEncoding messageVersion="Soap12" />
      <httpTransport/>
    </binding>
</customBinding>

with various messageVersion values. But I have yet to find a combination that works.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

在风中等你 2024-12-22 16:53:50

通过创建自定义 Dispatcher 来映射基于 SOAPBody 的调用来解决。

在 Microsoft WCF 示例中找到了解决方案。

示例位于:

Windows Communication Foundation (WCF) 和 Windows 工作流.NET Framework 4 的 Foundation (WF) 示例

确切示例(基于示例安装的文件夹)

可扩展性\Interop\AdvancedDispatchByBody

Solved by creating a custom Dispatcher to map calls based on the SOAPBody.

Solution found in a Microsoft WCF Samples.

Samples found at:

Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4

Exact example (based on the folder the samples are installed in is)

Extensibility\Interop\AdvancedDispatchByBody

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