A very tedious task of mine has often been to deploy AIF services accross environments. I am used to do this the old school way = manually.
Today I had something that might be compared to as an epiphany – I stumbled upon this great technet artichle descripting how to export the configuration settings using the data import/export framework. Tried it out for the first time today and it’s working just great. The only downside so far, is that I haven’t been aware of this feature before…:-)
Today I spent quite some time struggling how to figure out was wrong with my client implementation of an AIF webservice. I kept getting the error “The HTTP request is unauthorized with client authentication scheme ‘Basic’. The authentication header received from the server was ‘Basic realm="some_domain_name"’.”
It was the realm part I didn’t understand. I had configured the service in AX to use basic authentication. From a reference environment, I knew the configuration had been working.
It turned out that my focus on the realm part was wrong because the reason to the error was invalid login credentials. How invalid login credentials can trigger the above error message is not for me to say. I would have expected a message like “Failed to log in to Microsoft Dynamics AX” instead. Just thought I would share my experience…
Quite often when dealing with AIF service I am asked to send a WSDL for a service to a 3rd party partner. Typically the partner dowsn’t have access to the service in that phase of the project. This means that I would have to send physical wsdl files (and not just an URL). In my experience the “singleWSDL” feature introduced with .net framework 4.5 doesn’t work for AIF services. In these cases AIF can be quite thedius to work with because the wsdl references other wsdl files as well as xsd’s. So in order to being able to send an offline wsdl file to a partner, you have to do a little bit of manual work. Ofcourse there are many ways to achieve the same, but here’s a guide of way, that I have found quite easy to work with.
- Make sure the service has been published.
- Open visual studio and create a console application. Add a new service reference pointing to the your service. Visuial studio now creates proxy classes as well as downloads referenced wsdl’s and xsd’s. You should see something similar to this in your project:
Please note the 3 WSDL files and 6 XSD files.
- Locate the physical location of the files (right click in VS and look at the file properties)
- Copy all of the WSDL and XSD to a new folder of your choice (outside the project). This folder now contains the files that we want to send to our partner. But before sending them, we need to do some minor modifications.
- Open the RoutingService.wsdl in your editor (VS will do just fine). Find and edit all import statements:
You will se that the Locations attribute references a http address. Edit the location to point to the local file residing in the current folder.
You will want to do the same for the service location:
Make sure to point to the local file instead of the url.
- Do the same for the other 2 WSDL files. It’s quickly done.
- When finished You can test your work by going back into visual studio. Just simulate adding a new service reference pointing to the local wsdl files instead. Remember it is the RoutingService.wsdl that is Your point of entry. If VS doesn’t complain You are now finished.
- Finally zip the folder and sent it to the partner.
If You know of a better/easier way please post a comment…
Recently I had to configure an inbound port for basic authentication. Furthermore I had to produce a guide in order to being able to set it up in the same way in other environments.
Lucky for me, I found this great guide, that I would like to share. You can also use it as a template for configuring other types of authentication.
Recently I was working on a case where some issues occured when trying to synhronize data between MS dynamics ax 2012 and MS CRM.
In MS CRM the following maps have been set up for synchronization in two integrations.
Each integration uses its own AX user for connection.
From the CRM point of view, the synchronization seems to succeed. However going through the exception log in AX it seems that quite a few deadlocks have occurred, please see screendump below:
And here’s a screendump from the “general” tab showing the error message – “Cannot select a record in Change Tracking Version (AifSqlCtVersion). Change Tracking Version: 0.
Deadlock, where one or more users have simultaneously locked the whole table or part of it.”:
The deadlocks seems to have disappeared by themselves.
From this blog post this issue seems to be a known issue – https://community.dynamics.com/ax/f/33/t/160640 – however the ax database had not recently been updated.
The cause seems to be the SQL optimiser doing a clustered index scan (RecId) in the query below, resulting in blocking:
SELECT T1.CTVERSION,T1.CREATEDDATETIME,T1.RECVERSION,T1.RECID FROM AIFSQLCTVERSION T1 WITH ( UPDLOCK) WHERE (CTVERSION<@P1)
- Login to Dynamics AX –> Open a Development workspace, and navigate to AOT –> Dictionary -> tables,
Find the table AIFSQLCTVERSION , and create a new non-unique index for CTVERSION field
- Login to SQL server Management studio, and create a new plan guide for the query adding index hint
EXEC sp_create_plan_guide @name = N'[PlanGuide-AIFSQLCTVERSION]’, @stmt = N’SELECT T1.CTVERSION,T1.CREATEDDATETIME,T1.RECVERSION,T1.RECID FROM AIFSQLCTVERSION T1 WITH ( UPDLOCK) WHERE (CTVERSION<@P1)’, @type = N’SQL’, @module_or_batch = N’SELECT T1.CTVERSION,T1.CREATEDDATETIME,T1.RECVERSION,T1.RECID FROM AIFSQLCTVERSION T1 WITH ( UPDLOCK) WHERE (CTVERSION<@P1)’, @params = N’@P1 bigint’, @hints = N’OPTION (TABLE HINT (T1, INDEX( I_100021KOO_CTVERSIONIDX), UPDLOCK))’
GO(replace the index name I_100021KOO_CTVERSIONIDX with the actual name of the newly created index)
Recently I was presented with a very interesting problem that occured when Microsoft CRM was synchronizing with Microsoft Dynamics AX 2012 using the DynamicsConnector for MS Dynamics AX. The installation guide can be found here.
In basics it was a standard setup in both ends. When syncing only one company everything would work just fine, but when syncing two or more companies the online users would be filled with active connections that wouldn’t close by themselves. In the end this would lead to the AOS not accepting new clients or even a crash due to lack of RAM.
The strange thing was that everything was setup according to the guidelines and was working fine in a reference environment. A MS support request was created and I will try to summarize all of our findings and the solution that fixed the problem.
The problem in short:
- When running the synch of 2 or more companies simultaneously, the client session on AX continues to increase till the crash of AOS.
- Running synch of 1 company only (in other words 1 integration) the client sessions do not increase; looks like they are recycled.
- The problem occurs in all maps and seems to be a general problem in our scenario.
- The synchronization for all companies is running on the same AX account.
- The verified solution from MS was to create separate accounts for each synchronization.
In a recent task I had to redeploy an AIF http document service several times due to changes. Ocassionally the below error would occur when opening the inbound ports form. The error indicated that the classes related to my document service somehow would conflict because they were already registered. In the current state it would not be possible to activate a new inbound port.
Fortunateley a colleague of mine had experienced something similar and here is our guide that in the end solved my issue:
- Create a job that deletes everything from the SysXppAssembly
static void Job1(Args _args)
- Stop the AOS.
- Delete all files (and folders) from the “C:\Program Files\Microsoft Dynamics AX\60\Server\[instancename]\bin\XppIL” folder
- Start the AOS and go to Systemadministration/setup/services and application integration framework/inbound ports to check if the error has gone.
In most cases that would solve the problem. In one situation I experienced that the above gude was not enough. I also had to do the following:
- compile the entire application
- Perform full CIL
- Restart the AOS
Hope this helps…
Thanks to Henning Ejner Andersen for assisting me on this issue.