Skip to main content

Posts

Showing posts with the label web services

Consuming a Web Service in AX 2012 is easy

thank you JORIS DG For those of you who have read my post on the  Windows Azure App , may recall my shortcut for fixing the missing bindings and other app.config settings. I've been meaning to dig into this further and come to a solution, but for the Azure post being constrained by my promised " 10-minute  app " I stuck with the ugly solution. Recently I was talking with the MSDN  team about AIF related articles they are wanting to do, and I brought up this issue. They pointed out they had not seen this issue and asked if I had followed the  whitepaper on consuming webservices . Now, there's not necessarily a lot to it, but in looking over the whitepaper I found one tiny little thing, which makes a world of difference and solves my issue: AIFUtil class! This sparked the idea of doing a follow-up on this, and due to a late night conversation on  Twitter  related to this I figured I really need to get this on my blog. The issue as I'm about to explain ...

Calling a web service from X++ code

This post describes how to call the AIF sales order service from X++ code. The same approach can be used for calling any web service. In the AOT under the References node add a service reference specifying the wsdl location of the service, a .NET code namespace and a reference namespace. An example of a wsdl url is: http://myMachine.myDomain/MicrosoftDynamicsAXAif50/salesorderservice.svc?wsdl Once the reference has been created, in X++ create a new class that runs on the server. In a method in the class write the code that calls the service. An example of how to call the sales order service is below. Once the code in the class compiles close the AX client. Go to the Appl\Standard\ServiceReferences directory and copy the app.config and the generated assembly to the Server\bin directory. SalesOrder.SalesOrderServiceClient proxyClient; SalesOrder.AxdSalesOrder salesOrder; SalesOrder.AxdEntity_SalesTable salesTable; SalesOrder.AxdEntity_SalesLine salesLine; SalesOrder.AxdEntity...