Connecting to the WSE 3.0 Web Service from the WCF Client

I am having difficulty connecting to a third-party web service WSE 3.0 from a WCF client. I implemented my own binding class, as indicated in this article in KB:

http://msdn.microsoft.com/en-us/library/ms734745.aspx

The problem seems to be related to the security statement used by the web service - UsernameOverTransport.

When I try to call a method, I get the following exception:

System.InvalidOperationException: 'WseHttpBinding'. '[Names] required for' MyWebServiceSoap '. The '[Names] contract is configured with an authentication mode that requires transport layer integrity and confidentiality. However, vehicles cannot provide integrity and confidentiality.

Expected username, password and CN number. In the sample code provided by the supplier, these credentials are supplied to Microsoft.Web.Services3.Security.Tokens.UsernameToken. Here is an example of a provider:

MyWebServiceWse proxy = new MyWebServiceWse(); UsernameToken token = new UsernameToken("Username", "password", PasswordOption.SendPlainText); token.Id = "<supplied CN Number>"; proxy.SetClientCredential(token); proxy.SetPolicy(new Policy(new UsernameOverTransportAssertion(), new RequireActionHeaderAssertion())); MyObject mo = proxy.MyMethod(); 

This works great with the 2.0 w / WSE 3.0 application. Here is the code snippet of my WCF client:

 EndpointAddress address = new EndpointAddress(new Uri("<web service uri here>")); WseHttpBinding binding = new WseHttpBinding(); // This is the custom binding I created per the MS KB article binding.SecurityAssertion = WseSecurityAssertion.UsernameOverTransport; binding.EstablishSecurityContext = false; // Not sure about the value of either of these next two binding.RequireDerivedKeys = true; binding.MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt; MembershipServiceSoapClient proxy = new MembershipServiceSoapClient(binding, address); // This is where I believe the problem lies – I can't seem to properly setup the security credentials the web service is expecting proxy.ClientCredentials.UserName.UserName = "username"; proxy.ClientCredentials.UserName.Password = "pwd"; // How do I supply the CN number? MyObject mo = proxy.MyMethod(); // this throws the exception 

I searched the internet looking for the answer to this question. Some sources close me (for example, in the article MS KB), but I can not cope with the hump. Can someone help me?

+6
web-services wcf wse
source share
2 answers

I had success in a similar case with the following binding configuration:

 <bindings> <customBinding> <binding name="FNCEWS40MTOMBinding"> <security enableUnsecuredResponse="true" authenticationMode="UserNameOverTransport" allowInsecureTransport="true" messageProtectionOrder="SignBeforeEncrypt"> <secureConversationBootstrap /> </security> <mtomMessageEncoding messageVersion="Soap12WSAddressingAugust2004" maxBufferSize="2147483647" /> <httpTransport maxReceivedMessageSize="2147483647" /> </binding> </customBinding> </bindings> 

Hope this works for you too.

+9
source share

The error message refers to the transport layer , this usually means https.

You did not specify your configuration files. But I assume that you have configured security for the transport (or it is required as a coincidence of another choice) and used the http address, not https.

+1
source share

All Articles