Sunday, May 15, 2016

Consuming Navision 2009 webservice using BizTalk

Consuming a webservice is same no matter who exposes it  may be Navision or JDE or something else, if it is based on Soap1.1then use WCF- BasicHttp and if it is based on Soap 1.2 use WCF- WSHttp

I had a requirement to consume a Webservice exposed by Navision, was provided with the URL and the method to be invoked.

Authentication type : SPNEGO (Kerberos for delegation)
Authorization: Window Login

I used WCF-BasicHttp adapter and configured accordingly






After getting done with configuring, tried calling the service and got following error:

      Access denied.Delegation or impersonation permission is required for access.


Even tried configuring it in orchestration (below code) but got same error as above

MSG_Req(WCF.BindingType) ="basicHttpBinding";
MSG_Req(WCF.EndpointBehaviorConfiguration) =@"<behavior name=""EndpointBehaviorConfiguration""><clientCredentials><windows allowNtlm="false" allowedImpersonationLevel="Delegation"/></clientCredentials></behavior>";
Port_Dynamic_Req(Microsoft.XLANGs.BaseTypes.TransportType) = "WCF-BasicHttp";


Why it happened

The first thought would be access is not granted, but that was not the issue.The problem was the compatibility issue, Nav 2009 does not understand BasicHttpbinding. I  was able to call same Webservice when deployed in Navision 2013 but get an error when the service is deployed in Navision 2009. 


What to do


In my case due to some constraint this service has to run in Nav 2009. So below is solution (have added both ways to do -- choose which best suits your need). We  need to use WCF-Custom adapter with custom binding.

1. Configuration at port level

Select WCF-Custom adapter, on general tab provide the URL of nav service and appropriate Action.

On Binding Tab, set messageVersion to Soap11 against textMessagingEncoding

Select Negotiate as authenticationScheme under Httptransport 

Now on Behavior tab, extensions needs to be added, right click and select Add extension


And select client credentials

And against WindowsClientElement property specify it as Delegation


2. Configuration in Orchestration

MSG_Req(WCF.Action) = xyz ;
MSG_Req(WCF.BindingType) ="customBinding";
MSG_Req(WCF.BindingConfiguration) = @"<binding name=""xyz_Binding""><textMessageEncoding messageVersion=""Soap11"" /><httpTransport authenticationScheme=""Negotiate""/></binding>";
MSG_Req(WCF.EndpointBehaviorConfiguration) =@"<behavior name=""EndpointBehaviorConfiguration""><clientCredentials><windows allowedImpersonationLevel=""Delegation""/></clientCredentials></behavior>";


Port_Dynamic_Req(Microsoft.XLANGs.BaseTypes.Address) = xyz
Port_Dynamic_Req(Microsoft.XLANGs.BaseTypes.TransportType) = "WCF-Custom";




















1 comment: