Search code examples
c#wcf.net-core

Consuming custom binding web service service in .NET Core


I am successfully able to consume the workday webservice in my .NET Framework application using the custom binding configuration below.

<customBinding>
    <binding name="Human_ResourcesBinding">
        <security enableUnsecuredResponse="true" authenticationMode="UserNameOverTransport" />
        <textMessageEncoding messageVersion="Soap11" />
        <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
    </binding>
</customBinding>

With

Human_ResourcesPortClient hr = new Human_ResourcesPortClient();

hr.Endpoint.Address = new EndpointAddress("https://wd5-impl- 
   services1.workday.com/ccx/service/<TENANT_NAME>/Human_Resources/v32.0");

hr.ClientCredentials.UserName.UserName = "Username@Tenant"; 
hr.ClientCredentials.UserName.Password = "Password";

When I am using basichttps binding like below I am getting an error saying username and password are incorrect.

binding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport);

I want to convert the application to .NET Core, but I am not sure if I can specify the custom binding configuration anywhere or do I need to specify the custom binding programmatically. If I need to do it programmatically can anyone point me in the right direction or sample which will help me build such configuration?


Solution

  • Currently, .NET Core does not support the creation of WCF services, but you can create WCF clients in .net core to call WCF services. Although you can call WCF services in .NET Core, it is subject to some restrictions. The WCF client in .net core only supports four bindings: BasicHttpBinding, CustomBinding, NetHttpBinding, NetTcpBinding, and there are not many security features in .NET Core. My suggestion is to use WCF in the .NET Framework.

    About core's support for WCF, you can refer to this link:

    https://github.com/dotnet/wcf