I am new in Dynamic Ax too. Is there a tutorial which explains what are the operation to do on Dynamic Ax to expose the data?
I am new in Dynamic Ax too. Is there a tutorial which explains what are the operation to do on Dynamic Ax to expose the data?
First of all, a custom service isn't a tool appropriate for returning all customer. Instead, look at Query Service and AIF Document Services.
Anyway, the bug in your particular code is caused by the fact that you didn't specify which type of data you return in the collection. You should say that it's CustTable, so the right data contract can be generated. For example:
AifCollectionTypeAttribute('return', Types::Record, tableStr(CustTable))
Before we get into your actual question, let me deal with some moderator's stuff.
I moved this discussion from Expose Rest WCF Service in Dynamic Ax 2012 R3 Version, becuase you confirmed that your question isn't about the same topic. Please don't try to hijack threads that are about different things. If there is no suitable thread, simply create a new one (in the right forum, with a descriptive title etc.). And provide enough information about your problem.
Also, your code was difficult to read, because you posted it in a wrong way. Use Insert > Insert Code (in the rich formatting view) for this purpose. I've already update code in your reply above, therefore you can see how it looks.
Hi Martin, yes. I created a class that I am trying to consume from a simple desktop application in c# but it does not work.
This is my class in AX. I want to return all records from the table cusTable
[SysEntryPointAttribute(true), AifCollectionTypeAttribute('return', Types::Record)] public List getCustomerNameList() { CustTable cusTable; List list = new List(Types::Record); // return in a list all Customer Name while select * from cusTable { list.addEnd(cusTable); } return list; }
When I try to distribute the service group I get this error:
Unable to generate service 'TestCustomerServiceDemo'.\n Error: Unable to create and return the AifCollectionTypeAttribute object for the.getAttributes() reflection API. Verify the parameters.
In c# I imported the service reference and I call the method:
ServiceReference1.CallContext context = new ServiceReference1.CallContext(); var request = new ServiceReference1.TestCustomerServiceDemoGetCustomerNameListRequest(context); ServiceReference1.TestCustomerServiceDemoClient client = new ServiceReference1.TestCustomerServiceDemoClient(); var response = client.getCustomerNameList(request);
Can you help me please?
Hi ax70, it sounds like you're looking for information about AX web services in general, rather than about how to expose them as RESTful services. It that correct?
If so, please create a new thread for your topic, because it doesn't belong here.
André Arnaud de Cal...
293,001
Super User 2025 Season 1
Martin Dráb
231,837
Most Valuable Professional
nmaenpaa
101,156
Moderator