【问题标题】:WCF service for gSOAP clientgSOAP 客户端的 WCF 服务
【发布时间】:2011-11-14 14:04:58
【问题描述】:

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

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

我得到的问题是,当将绑定分配给basicHttpBinding 时,我得到Action '' not supported 的错误,因为客户端不发送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 服务来处理来自客户端的请求。 (不能以任何方式修改客户端)

我已尝试设置自定义绑定

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

具有各种 messageVersion 值。但我还没有找到有效的组合。

【问题讨论】:

    标签: c# .net wcf soap gsoap


    【解决方案1】:

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

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

    样本位于:

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

    具体示例(基于安装示例的文件夹)

    Extensibility\Interop\AdvancedDispatchByBody

    【讨论】:

    • 请编辑您的答案并包含指向有帮助的示例的链接。 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多