Friday, July 6, 2012

Consuming currency web service in AX 2009

Im going to show you how to consume a web service in Dynamics AX. I had a requirement to consume currency exchange rates between my customer and a bank. however the bank did not have any available web service. So my B2B integration required me to create a web service at the bank end and then consume it again at my customer end. I will share with you how i consumed it in Dynamics AX2009.


In this demo we are going to do:


1) Create a service reference in AX2009

  • Go to  AOT > References > Right-Click Add New Service Reference.
Note WSDL URL should refer to your web service http address or in this case a free web service which is equally good.
The ExchRateWebService is the name of your reference.


2) Create an AX2009 class to consume the service

  • Next  AOT > Classes and create a new class

public class EtugExchRates 

{



}

  • add the following method to your class

3) Create a Job to test the code in AOT >Jobs
4) Go to General Ledger>Setup>Exchange Rates after running the job to see the result

Happy Dax++ng guys!!