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

How to consume web services effectively

(0) ShareShare
ReportReport
Posted on by 88

What I need:

Create web services to pass data like 1000 rows daily but every row weight about 2-5 MB - passing data with PDF's.

Create web services to pass data with actuall warehouse stock about 20-25k rows 1h interwal or on demand.

What I did:

Create web service for my first need. It's JSON based web service. It's deployed I see it via the .../api/services/myWebGroup/MyWebService

My problems.

I tried to consume this web service like some tutorials show but everytime when I try to add web service references into my C# project and I add my link ../api/services/myWebGroup/MyWebService I get stuck into validation. Is my domain account insuficcient? If I try to add web reference I can log in and it download the JSON file but only with headers.

{"Parameters":[{"Name":"_company","Type":"String"}],"Return":{"Name":"return","Type":"InvoiceWSContract"}}

The same problem occours trying to get into any defaul web service like:
usnconeboxax1aos.cloud.onebox.dynamics.com/.../GetUserSessionInfo

Could anyone provice me some help with this? I did read quite a bit searching for solution but nothing worked for me.

  • Martin Dráb Profile Picture
    231,801 Most Valuable Professional on at
    RE: How to consume web services effectively

    I am saying that if you don't want to call F&O, web services for calling F&O are useless to you. They're used in different scenarios.

    Performance is exactly what I would worry about in your architecture. BYOD export is very efficient, if used correctly. First of all, there is incremental export, therefore you don't have to transfer all the data every time. Also, storing files in relational databases isn't optimal. Why don't you store them outside the DB (which will also reduce backup and restore times and potentially reduce costs, because DB sotrage is expensive), such as on SharePoint, and don't transfer just a link? This will greatly improve efficiency of your data export.

    BYOD is used by many companies. Think about if your problems with it can't caused by the way how you're using it. Just saying...

    You can find information about Azure Functions in Azure documentation.

  • RadekM Profile Picture
    88 on at
    RE: How to consume web services effectively

    I'm not saying something is useless. Even BYOD that we already have tested quite a bit.

    Just imagine sending PDF's with a entity to BYOD it would take time, this table already has got about 100GB over the years. At this moment we use it for reporting purposes, we got custom entities for our tables. We export like 100 entities, users complain about the aplication speed turing this exports. When a entity sometimes get error/ timeout or something else not everyhing is cleaned on BYOD. We got sometimes duplicated rows in there. Also there are some connection problems with BYOD, we run jobs to get data from it and sometimes it just end's with connection errors.

    Could you please tell me something about the Azure Funtion?

    It would be really good if user could manually somehow run / update the database directly from AX.

  • Martin Dráb Profile Picture
    231,801 Most Valuable Professional on at
    RE: How to consume web services effectively

    Let me repeat it once more. F&O offers web services to allow other applicatios to call it. For example, you could have a console application or an Azure Function asking F&O for new data on a regular basis. But you seem to be talking about the opposite scenario - you want F&O to push data somewhere. If so, web services for calling F&O are useless to you (unless you change your achitecture).

    You could still use web services, but these would be web services offered by the other application.

    Didn't you consider BYOD? It sounds much more approriate for what you need and it's already ready to use.

  • RadekM Profile Picture
    88 on at
    RE: How to consume web services effectively

    For D365FO Cloud we need to update a external database with our data. This external database is used by our clients for planning. They get the data from ( as far as I know some clients use webservice to get this data but they dont use AX) it and use it the way they need. The best and only way so they don't need to change their mechanism is to change it all on our way to update the right tables.

    We have a mechanism for it but it works actually only local since we still use on premise version.

    Since we must migrate into clound in next months we want to go into web servies. There will be propably a Azure database created for storage insted of our local.

    Honestly, we are green in this web services. We're not sure what is able to do and what not.

    Some data need to be able to push manually on need but actually it need to be passed 1 time/day. For that we did think we can run our webservice with event / button manually or with a batch running every day.

    Second thing passing warehosue data need to be pushed every 1h at least but it would be great if for example It would update the table on call on database or so it would react on changes in AX and push data near real time.

    That just our hopes.

  • Martin Dráb Profile Picture
    231,801 Most Valuable Professional on at
    RE: How to consume web services effectively

    What do you want to ask about in your first sentence? I see just a condition, but not what you need. Maybe you should start by explaining your business scenario. Are you trying to call one F&O environment from another? In case you aren't aware of it, these services are called by external applications. If you want to call other applications from F&O, that's the opposite direction.

    Regarding where the find the classes, please follow the link in my previous reply.

    I'm sorry, but I don't know what you mean by mobile apps here. No, registration in AAD doesn't cost anything.

  • RadekM Profile Picture
    88 on at
    RE: How to consume web services effectively

    Ok so if I would like run this web service with a batch or manually call it from AX?

    About the problem it's not found in context. AuthenticationUtility is also missing so that must be the case. Where can I find it to attach?

    I have one registered user(or whatever it is called) in AAD for our mobile apps, it's possible to use it here? Registering come with any price?

    I think there should be need also a service to run from SSMS. But thats not the case now. I would like to run a web services once the table on SQL gets hit by a user. When somebody need the data stored in a specific table to get the most actually data.

  • Martin Dráb Profile Picture
    231,801 Most Valuable Professional on at
    RE: How to consume web services effectively

    What type of project youy should create depends on what kind of application you want to build. For instance, what you've linked is a console application. If you create a class library, it won't be executable - you'll still need an application where you would use your library.

    Could you please tell us what problem you have with ClientConfiguration and OAuthHelper? If you're not aware of it, these classes are defined in AuthenticationUtility and you need change configuration in ClientConfiguration.cs.

    A registration in Azure Active Directory is needed in all cases.

  • RadekM Profile Picture
    88 on at
    RE: How to consume web services effectively

    Okay that explains something to me at least. So now.

    I did try also the shared on github code from docs. Do I need to create here a specific project or just a class library .Net framework?

    https://github.com/microsoft/Dynamics-AX-Integration/blob/master/ServiceSamples/JsonConsoleApplication/Program.cs

    But VS gives mr problems with this lines. ClientConfiguration and OAuthHelper.

    using AuthenticationUtility;
    
    string GetUserSessionOperationPath = string.Format("{0}{1}", ClientConfiguration.Default.UriString.TrimEnd('/'), sessionUrl);
    
    request.Headers[OAuthHelper.OAuthHeader] = OAuthHelper.GetAuthenticationHeader();
    

    I did also try to use POSTMAN to connect but it looks like there need to be some configuration like registering in azure web application.

  • Suggested answer
    Martin Dráb Profile Picture
    231,801 Most Valuable Professional on at
    RE: How to consume web services effectively

    "Add service reference" is based on WSDL provided by SOAP services. But you're using a JSON-based endpoint, which is a different thing. In that case, don't add any reference and simply call the service via HTTP.

    You get the service description if you call the JSON-based endpoint with GET.

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... 292,961 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,801 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans