web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Not get data from WCF Service

(0) ShareShare
ReportReport
Posted on by

Hi all,

I use X++ to create Service in AX to get data from AX, but when deploy I've got a problem that:

I can get data from services that get data from table object exist in AX 2009

but I can't get data from services that get data from table object (tables was created when upgrade from AX 2009 to AX 2012), it hasn't got error from service but data always  return 0 items object

In detail action:

In development environment, I'm coding completely  in AX 2012 so that services run completely OK

when deploy to production environment, I export axmodel file from AX 2012 in dev environment then use axmodel to import to pro environment

Can anyone help me to show problem in this scenario ? what's different from here ?

thank you,

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    If I understand it correctly, your solution works in DEV, but you aren't able to successfully deploy it to production. So it doesn't have anything to do with AX 2009. Is that correct?

    Your instructions don't mention compilation and generation CIL, which may be the first problem.

    Then review your inbound ports - it the port active?

    Is the service client connected to the right address?

    If the service works in production but it doesn't return the expected result, check if you aren't getting data from a wrong company.

    If you still have the same after checking all this things, please tell us more about your service (what kind of service it is, what it does etc.). It will help us to devise a further troubleshooting strategy.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    First of all you are doing your releases to Production incorrectly.

    daxmusings.codecrib.com/.../deploying-your-ax-2012-code.html

    You have to release by modelstore, once you made sure your Production environment's Model Element Id's are identical in your source environment too (i.e. by moving a full backup of the databases of Prod).

    The reason why this probably fails is that with a model, you are missing a lot of steps that you should have done with a proper release management process. Like Martin said, first of all you have no CIL compiled, which is mandatory for processes executing on server-side. The modelstore does contain that, along with Element Id's, while the model does not.

    Then you have to re-register the Service from the Add-ins menu in the AOT, and from the AIFServices form that you could open again in the AOT it is also recommended to Refresh the service endpoint. After that you should deactivate / activate the AIF inbound port.

  • Community Member Profile Picture
    on at

    Hi Martin,

    That right, that's my problem

    About compilation and generation CIL, I think it's a problem, but the first time when import model I have executed completely compile, and there are some service can get data

    inbound ports : i use 8201 for WCF, and it active

    service client connected to the right address, because I call successfully service, it hasn't error, and right authentication

    My service is execute to get data from table in database of AX, when business in AX insert/update/delete relate to that table object, and I use SysDatabaseLog to trace the change info

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    All right, focus on CIL then. If you don't build CIL, your changes in X++ aren't visible to services.

    By the way, when we talk about inbound ports, we mean System administration > Setup > Services and Application Integration Framework > Inbound ports, not TCP ports.

  • Community Member Profile Picture
    on at

    Hi Martin,

    I've found the problem in my scenario, that relate to authorization for user to difference company in AX

    The reason is account used to access the service only has to read the data of a company and does not have the right to read the data of other companies

    I have found the solution is to create a virtual company account so that readable of all company data

    So It is a right and good solution ? and you've got to be a better solution?

    thank you,

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Why don't simply grant the users access to data they need? That doesn't require any virtual company. By the way, virtual companies don't exist in the latest version of AX, so you would have to throw away your solution on upgrade and do it properly anyway.

  • Community Member Profile Picture
    on at

    Hi Martin,

    Because my requirement only has one account able to access to service AX, thank for your advice about Virtual account.

    By the way, I've found another solution, that is crossCompany keyword can be added to your X++ SQL statement, it help get all data from all company

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    If you have wrong security setup, the only correct solution is setting security correctly.

    But I suspect you're talking about the company context of a service, which is a different topic than authorization. The service runs in the context of user's default company, unless you provide a different company in CallContext. If you want to access data across companies in a single web service run, "cross company" is the right solution. If you want different instances to run in different companies, the right solution is setting the company in CallContext.

  • Community Member Profile Picture
    on at

    That right , my reason is company context of a service, and  I want to access data across companies in a single web service run

    thank you, Martin!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans