A. Firstly, Create a Service Group in AX 2012 (Go to AOT > Service Groups > Create SalesOrderServiceGroup1 - in this case.)
B. Next, drag and drop the SalesSalesOrderService from AOT > Services > to the newly created Service Group in Step A
C. Deploy the SalesOrderServiceGroup1
D. Now, the Service should list in System Administration > Setup > Services and Application Integration Framework > Inbound Ports
E. You should be able to browse the wsdl now.
F. Now Open Visual Studio, File > New Project Create a Windows Application (Windows Form or Console) and Add the above Service in Service References node.
G. Below is a sample sales order input form (I just created a simple UI as the whole purpose here is to show how to consume Dynamics AX 2012 Services from VS.Net), so this UI takes customer, item and qty and creates an order in AX.
H. Below is the sales order view from AX
VS.Net Code:
Below is the .Net code which consumes the service. It's pretty much the same which we have been using with previous versions of Dynamics AX alongwith VS.Net i.e. It constructs the Sales Order Document and Entity Objects, then populates it, finally calling the create method.
Troubleshooting:
http://daxdilip.blogspot.com/2011/10/troubleshooting-dynamics-ax-2012.html
http://daxdilip.blogspot.com/2011/10/troubleshooting-dynamics-ax-2012.html
References:
Thanks to Murray for sharing this presentation which helped me with my demo.
http://www.slideshare.net/murrayfife/creating-and-consuming-web-services-in-dynamics-ax-2012
http://blogs.msdn.com/b/aif/archive/2011/06/15/microsoft-dynamics-ax-2012-services-and-aif-white-papers.aspx
Hi Dilip,
ReplyDeleteI have used your post to create sales order in AX from crm.
But it gives me error that user is unrecognized.
Hi,
ReplyDeleteI have used your post to save sales order in AX from CRM form.
But i m getting error like user is unrecognized.
Excellent post. Just what I was looking for. Be nice to have the code shown as text rather than a jpeg though. That way it could be copy and pasted. Many Thanks.
ReplyDeleteExcellent post. Just what I was looking for. Be nice to have the code shown as text rather than a jpeg though. That way it could be copy and pasted. Many Thanks.
ReplyDeleteExcellent post. Just what I was looking for. Be nice to have the code shown as text rather than a jpeg though. That way it could be copy and pasted. Many Thanks.
ReplyDeleteExcellent post. Just what I was looking for. Be nice to have the code shown as text rather than a jpeg though. That way it could be copy and pasted. Many Thanks.
ReplyDeleteHi Dilip,
ReplyDeleteThank you for your post.
Do you have an example about "How to consume AX 2012 PurchaseRequest service from VS.NET"?
Hi Dilip,
ReplyDeleteHow do make the form push the data over to my salestable. I have created the form but cant create. Help did I miss a step
Hi, I was wondering what version of AX and visual studio you are using. I'm attempting to do the same gig but for some reason the salesTable.ReceiptDateRequested is not accessible to me. I'm using AX2012 + Visual Studio. It seems that the ReceiptDateRequested field is mandatory but it's not even visible in the Data Policies.
ReplyDeleteAny ideas?
Hi Dilip,
ReplyDeleteHave you come across the double hop issue (I think thats what it is?). I am consuming the service (Ax2012) from a different server, via an ASP .NET Application. It only works if i specify the Windows authentication. i.e. it doesnt impersonate. Im trying to stick with Integrated mode on IIS
-Shashi