我需要調用一些需要WS-Security的第三個Web服務。我創建了一個WCF端點配置如下:WCF是否支持帶有SOAP 1.1的WS-Security?
<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>
的問題是,第三方服務器中拋出以下異常:
Received protocol '_http://schemas.xmlsoap.org/wsdl/soap12/', required protocol '_http://schemas.xmlsoap.org/wsdl/soap/'.
據我所知,使用的wsHttpBinding將導致WCF發送使用basicHttpBinding時的SOAP 1.2請求將導致SOAP 1.1請求。由於WS-Security部分是必需的,據我所知,我必須使用wsHttpBinding。我的問題是如何強制一個SOAP 1.1請求?我有什麼選擇?
我試過將wsHttpBinding更改爲basicHttpBinding,但它會導致異常並且不會將其發送給第三方服務器。從我讀到的,basicHttpBinding與證書認證不兼容。我錯了嗎? – 2011-03-23 23:02:14
MSDN表示支持證書認證:http://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpmessagecredentialtype.aspx – 2011-03-23 23:33:11