In AX 2012, How to show WCF service as REST

I am currently providing AX 2012 services, how do I configure it to show it as REST?

I need to use this service in Xcode MAC for IOS integration, I find it easy if it's REST than SOAP.

+4
source share
1 answer

Well, there is an interesting question, but without a direct answer: (

I would say that there is no simple and easy way to expose your AxS service for WCF as REST, but there are workarounds. Here is what I will do.

You can also create your own ASP.NET WebAPI project, which can be hosted in IIS or hosted independently in a service or executable file. ( WebAPI website and tutorial to create a simple WebAPI project). This WebAPI project actually uses ASP.NET MVC 4.0, so you can create controllers for storing logic to retrieve data.

In the tutorial, products are downloaded, and in the controller the array is used for demonstration purposes.

Product[] products = new Product[] { new Product { Id = 1, Name = "Tomato Soup", Category = "Groceries", Price = 1 }, new Product { Id = 2, Name = "Yo-yo", Category = "Toys", Price = 3.75M }, new Product { Id = 3, Name = "Hammer", Category = "Hardware", Price = 16.99M } }; 

Well, now what you can do is replace this with a service call to your AxS service. By doing this, external users can actually make HTTP requests to your WebAPI site, and WebAPI will handle all your routing and return the JSON format.

For instance:

  • "HTTP: // local: xxxx / API / Products / 1"
  • "HTTP: // local: xxxx / API / products category = hardware"

And in the background, the controller itself can make Ax service calls using the SOAP path with WCF.

+6
source

All Articles