WINDOWS Live Search

To contact me for any clarifications regarding any posts / information, please mail me at arijit [dot] basu [at] gmail [dot] com


Friday, January 15, 2010

AX on Cloud 9

Lately there has been a lot of activity related to cloud computing with introduction of Windows AZURE. It truly is an interesting technology providing businesses wider opportunities. Well I decided to explore AZURE a bit and did a small POC on AX integration with AZURE. Well I hit on many roadblocks but was able to overcome them. In my POC I have created a simple WCF service on AZURE Platform and I'm calling that service from AX. The steps are as follows:

1. Setup and configure the AZURE Development prerequisites.
AZURE Account can be obtained at http://windows.azure.com
It is important you download the AZURE Platform Training Kit from MSDN. Really helpful.
2. Create the AZURE WCF Service using Visual Studio 2008 or 2010.
I created a very simple service which accepts employee code and returns the credit rating.

When I went to deploy the service, I got an error and on further investigating I found that SQL Express is required . I was on SQL 2008. Well there is a workaround for this in case you are on SQL 2008. Open AZURE SDK Command Prompt and key in the following as shown and press enter. This will allow you to use SQL Server 2008 for your AZURE Developments.
DSInit /sqlInstance:. /forceCreate


3. Deploy the Service on the Cloud.
Use the demos and the instruction in AZURE Platform Training Kit to deploy the service in the cloud in the Production instance.
Browse the service by providing the service name on your browser. You will be able to see the service.

One important thing to notice here is that service name marked above in red.
This is something which will give you issues when you want to generate proxy using wcftestclient or svcutil and also with Dynamics AX :-). There is a hotfix available from Microsoft KB971842 . I could however not use this hotfix as I got an error while trying to install. Im on WIN 2008. Nevertheless the show must go on. My service was up in the cloud and I needed to now access it from AX.
4. Consume the service from AX 2009.
As with general wsdl files, in AX when you go to add a service reference using http://daxguy.cloudapp.net/Service1.svc, you will get an error as shown. There is a issue with AZURE wcf services and proxy generation :-(

Well the workaround is to use your local service http://localhost:50026/Service1.svc to generate the proxy in AX 2009 and then configure the Service Reference using the MS WCF Service Configuration editor to change the service reference. See the screenshot below.


This will change the config file in the Service References folder in your AX 2009 Application Instance folder.
Now write some code to call the service. I created a small form where I pass an employee code and get the credit rating of the employee. Just to be on the safe side, I shut down my local IIS server just to ensure that I was really referring to the cloud.

The code sample is as follows in AX 2009.
And it was working. Really cool. I was consuming a AZURE WCF Service from Dynamics AX. There is a lot of potential in this. Maybe in next generation AIF , developers will be able to generate Cloud AIF directly from AX :-).
I had also created a Windows Application to test this out in similar ways and it worked nicely.
Happy DAXing :-)

1 comment:

Anonymous said...

Don't stop posting such themes. I love to read articles like that. BTW add some pics :)