WCF: CustomBinding confuses endpoint
I am using CustomBinding to enable Soap 1.1 (endpoint does not support 1.2) + Addressing 1.0. The endpoint is only available over SSL, and runs on some kind of Java/Weblogic platform.
Here is my configuration:
<customBinding>
<binding name="Soap11Addr10">
<textMessageEncoding messageVersion="Soap11WSAddressing10" />
<httpsTransport/>
</binding>
</customBinding>
[...]
<endpoint address="https://sekrit:444/more-sekrits/even-more"
binding="customBinding" bindingConfiguration="Soap11Addr10"
contract="SomePort" name="SomePortService" />
This configuration seems to confuse the endpoint. When I perform a request against SomePort, WCF first sends a RequestSecurityTokenResponse message, which 开发者_如何学CI think may be unfortunate. Here is a trace of the RSTR envelope:
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue</a:Action>
<a:RelatesTo>urn:uuid:7348d908-b767-43e8-9770-09a38461ee87</a:RelatesTo>
</s:Header>
<s:Body>
<t:RequestSecurityTokenResponse Context="uuid-7a3c9fde-053d-46e7-aa08-f5725b082691-287" xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<t:BinaryExchange ValueType="http://schemas.xmlsoap.org/ws/2005/02/trust/spnego" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">TlRMTVNTUAACAAAAEAAQADgAAAA1wpriPjzjL4iwIJhAmcsBAAAAAGAAYABIAAAABgByFwAAAA9TAEsATwBHAEsAQQBUAFQAAgAQAFMASwBPAEcASwBBAFQAVAABABAAUwBLAE8ARwBLAEEAVABUAAQAEABTAGsAbwBnAGsAYQB0AHQAAwAQAFMAawBvAGcAawBhAHQAdAAHAAgAj73D884kywEAAAAA</t:BinaryExchange>
</t:RequestSecurityTokenResponse>
</s:Body>
</s:Envelope>
The endpoint barfs:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header></env:Header>
<env:Body>
<env:Fault xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode xmlns="">ns0:MustUnderstand</faultcode>
<faultstring xml:lang="en" xmlns="">One or more mandatory SOAP header blocks not understood</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
Is it possible to stop the initial RSTR from being sent?
I can provide more trace and log data upon request.
Without knowing more about the target service it is hard to say what it expects but I would guess that WCF is using message security which means that each message is encrypted individually. You probably just want transport level security (i.e https).
You could try setting <security mode="Transport" />
in the binding configuration.
精彩评论