【发布时间】:2011-03-23 22:51:06
【问题描述】:
我需要调用一些需要 WS-Security 的第 3 个 Web 服务。我使用以下配置创建了一个 WCF 端点:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="TestBinding">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="TestBehavior">
<callbackDebug includeExceptionDetailInFaults="true" />
<clientCredentials>
<clientCertificate findValue="Acme" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" />
<serviceCertificate>
<authentication certificateValidationMode="PeerOrChainTrust" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="https://acme.com/webservices" binding="wsHttpBinding" bindingConfiguration="TestBinding" behaviorConfiguration="TestBehavior" contract="AcmeContract" name="AcmeEndpoint"></endpoint>
</client>
</system.serviceModel>
问题是第 3 方服务器抛出以下异常:
接收协议 '_http://schemas.xmlsoap.org/wsdl/soap12/', 所需协议 '_http://schemas.xmlsoap.org/wsdl/soap/'。
我了解使用 wsHttpBinding 将导致 WCF 发送 SOAP 1.2 请求,而使用 basicHttpBinding 将导致 SOAP 1.1 请求。由于需要 WS-Security 部分,据我了解,我必须使用 wsHttpBinding。我的问题是如何强制发出 SOAP 1.1 请求?我有哪些选择?
【问题讨论】:
标签: c# .net wcf soap ws-security