Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Exposing data from AX

(0) ShareShare
ReportReport
Posted on by 10

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?

  • Suggested answer
    Martin Dráb Profile Picture
    231,837 Most Valuable Professional on at
    RE: Exposing data from AX

    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))

  • Martin Dráb Profile Picture
    231,837 Most Valuable Professional on at
    RE: Exposing data from AX

    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.

  • ac70 Profile Picture
    10 on at
    RE: Expose Rest WCF Service in Dynamic Ax 2012 R3 Version

    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?

  • Martin Dráb Profile Picture
    231,837 Most Valuable Professional on at
    RE: Expose Rest WCF Service in Dynamic Ax 2012 R3 Version

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,001 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,837 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans