WCF client, WSE service, UsernameOverCertificate
- From: "Phil Lee" <phil.lee@xxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Dec 2007 14:26:56 -0000
I have an existing WSE3 implementation using UsernameOverCertificate and decided the best way to migrate to WCF was to migrate the client first and the service later.
After studying the available samples (e.g. http://msdn2.microsoft.com/en-us/library/ms752257.aspx) I have managed to migrate the client but still have a few issues.
1) It doesn't work if I set EstablishSecurityContext=true in the client and set establishSecurityContext="true" in the service's policy.
2) Our service populates SoapException.Detail with extra information when raising an exception. The WCF client rejects this with:
Server returned an invalid SOAP Fault. Please see InnerException for more details.
End element 'Fault' from namespace 'http://www.w3.org/2003/05/soap-envelope' expected. Found element 'detail' from namespace ''.
3) If the server throws any SoapException (without setting the fault detail) the client reports
"The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state."
and no further information appears to be available.
So my questions are:
1) Is it possible to use EstablishSecurityContext with WCF -> WSE3 and if so how?
2) Is it possible to configure the WCF client to accept the custom fault detail information?
3) I would have thought exception info generated by a WSE3 service be available in a WCF client. What's going wrong?
I can post my test code if required, however the basics are below.
The WCF client can be configured using app.config + some code, or all in code.
This is the .config version:
<security authenticationMode="UserNameForCertificate" messageProtectionOrder="SignBeforeEncrypt">
<secureConversationBootstrap messageProtectionOrder="SignBeforeEncrypt" requireDerivedKeys="true" />
<textMessageEncoding messageVersion="Soap12WSAddressingAugust2004" />
<endpoint address="http://localhost:2345/Service1.asmx" binding="customBinding"
<dns value="Test" />
This is the code version:
EndpointAddress address = new EndpointAddress(new Uri("http://localhost:2345/Service1.asmx"),
WseHttpBinding binding = new WseHttpBinding(); // from "Interoperating with WSE" sample (http://msdn2.microsoft.com/en-us/library/ms752257.aspx)
binding.SecurityAssertion = WseSecurityAssertion.UsernameForCertificate;
binding.EstablishSecurityContext = false;
binding.RequireDerivedKeys = true;
binding.MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt;
Service1SoapClient client = new Service1SoapClient(binding, address);
Plus configure certificate in code:
ClientCredentials clientClientCredentials = client.ClientCredentials;
UserNamePasswordClientCredential userNamePassword = clientClientCredentials.UserName;
userNamePassword.UserName = "user";
userNamePassword.Password = checkBox1.Checked ? "password" : "rubbish";
- Prev by Date: MTOM Error Meesage
- Next by Date: RE: WSE2 How to set SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
- Previous by thread: MTOM Error Meesage
- Next by thread: RE: WSE2 How to set SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS