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

wcf-basichttp configuration

wcf-basichttp configuration 1

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

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

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.

wcf custom property message version
On Binding Tab, set messageVersion to Soap11 against textMessagingEncoding

Negotiate as authenticationScheme under Httptransport
Select Negotiate as authenticationScheme under Httptransport 

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

And select client credentials
client credentials

And against WindowsClientElement property specify it as Delegation
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";

If you have questions or suggestions, feel free to do in comments section below !!!

Do share if you find this helpful .......
                          Knowledge Sharing is Caring !!!!!!


If you have any suggestions or questions or want to share something then please drop a comment

  1. nice blog keep updating your blog and i am waiting for your next update alsoBiztalk Online course

  2. Super post! Saved my day in implementing a connection from biztalk2010 to NAV

Previous Post Next Post