Geeks With Blogs
Charlie Mott

Article Source:

How do you send "Call Context" information in the header message to Dynamics AX 2012 WCF services from BizTalk? 

One difference between AX 2009 and AX 2012 services, is that you no longer always need to provide destination endpoint context information. This is described here:

In previous releases, each AIF endpoint was associated with a specific company. Microsoft Dynamics AX 2012 does not require that you associate integration ports with a specific company. You can use the integration port functionality to restrict service calls to a specific company. For an inbound message, the services framework obtains the company from the message header. If the message header does not contain a company context, the services framework uses the default company for the submitting user.

Adding WCF.OutboundCustomHeaders

In my requirement, I did need to send the Company code.

There is a very good article here about making BizTalk send header information to AX 2009 using WCF Services.

However, the implementation is slightly different with AX 2012. The schema namespace you need is

So the code will look like this. Notice I have only provided the header context information needed:

wcfHeader = System.String.Format(@"<headers><CallContext xmlns=""""><Company>{0}</Company></CallContext></headers>", companyCode);

msgRequest(WCF.OutboundCustomHeaders) = wcfHeader;

Other Tips

You may need to increase the size of the WCF-NetTcp adapter "Maximum receive message size". Otherwise, if the responses are large, you may get a System.ServiceModel.CommunicationException: The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

Posted on Friday, May 6, 2011 4:04 AM BizTalk , Dynamics AX | Back to top

Comments on this post: Sending header details in messages to Dynamics AX 2012 WCF services from BizTalk

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © charlie.mott | Powered by: