【问题标题】:Set TextMessageEncoding-message version in wsHttpBinding在 wsHttpBinding 中设置 TextMessageEncoding-message 版本
【发布时间】:2018-03-06 00:31:09
【问题描述】:

我正在尝试使用 wsHttpBinding 调用 SOAP1.2 服务。服务接受拒绝默认的 Soap12WSAddressing10 消息版本。它只接受 SOAP12

我从 Internet 搜索中得到的一个建议是在自定义绑定中创建 TextMessageEncodingElement。

如何使用代码或配置来完成?

WSHttpBinding myBinding = new WSHttpBinding();   
myBinding.Security.Mode = SecurityMode.Transport;            
myBinding.Security.Transport.ClientCredentialType = 
HttpClientCredentialType.Certificate;
//MessageVersion = SOAP12

在使用自定义 wsBinding 时,也没有建议的占位符来指定消息版本。

<wsHttpBinding>       
<binding name="customWS">          
<security mode="Transport">
<message clientCredentialType="Certificate"></message>            
</security>          
</binding>
</wsHttpBinding>

【问题讨论】:

    标签: wcf wshttpbinding


    【解决方案1】:

    Soap12 通过内容类型标头指定soapaction。我认为它没有在网络核心中实现。我使用以下代码。

    var encoding = new TextMessageEncodingBindingElement(MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None), Encoding.UTF8);

    但这在net core中没有实现。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-08
      • 1970-01-01
      • 2017-01-12
      • 1970-01-01
      • 2011-01-10
      • 2014-04-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多