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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to consume oracle API in ax 2012 R3

(0) ShareShare
ReportReport
Posted on by 20

Hi All,

I want to consume oracle API in ax 2012 R3. Oracle team has provided me a URL so that I could consume that URL and access the JASON file available on it.

After accessing that JASON file I have to fill in the data from that JASON file to a staging table available in AX.

Please help with the process.I tried to google but not getting anything related to it.

Thanks

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

    It depends on what kind of API it is. Oracle is a huge company with many products, each of them probably has its set of programming interfaces (APIs).

    I think you actually mean JSON (JavaScript Object Notation) instead of JASON.

    In general, you can use one the (many) .NET libraries for working with HTTP, such as WebClient. Before you can call the service, make sure you know ho to authenticate. When you get JSON, you can utilize NewtonSoft.Json library, for instance, to parse the text to objects that are easier to work with. Visual Studio has a nice feature for pasting JSON as C# classes. You can use such objects from X++ via .NET Interop.

    This is a really brief introduction, but it should help you to start. You can always ask for details if you get stuck somewhere.

  • Somesh Kumar Dubey Profile Picture
    20 on at

    302355.Capture.PNG

    Hi Martin,

    Thank you so much for your response.

    Yes,It's JSON(sorry for that).

    I followed the Microsoft  doc: docs.microsoft.com/.../walkthrough-calling-an-external-web-service-from-x

    to call the web service but while adding the service reference I am getting the error given above2654.Capture1.png.

    When I am opening the API URL normally in system.It does open.

    Please help.

    Thanks

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

    The tutorial is about a SOAP service. That uses XML, so when you're talking about JSON, it must mean that your service isn't based on SOAP.

  • Somesh Kumar Dubey Profile Picture
    20 on at

    Thank you for the information Martin..

    Could you please show me the path that how it could be achieve?

    Thanks

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

    As I said, there many ways, but if it's an HTTP service, consider using WebClient class (I gave you a link in the first reply).

  • WillWU Profile Picture
    22,361 on at

    Hi Somesh,

    Also please see the blog:

    www.exploreax.com/.../

  • Somesh Profile Picture
    55 on at

    Hi Will, Thank you for the link.

    www.exploreax.com/.../

    I have checked that out, and for json like following:

    {

       "success": true,

       "data": [

           {

               "CUST_GROUP_ID": 1,

               "CUST_GROUP_NAME": "Customer Group 1",

               "INSERT_FLAG": "Y",

               "RECORD_SENT_FLAG": "N",

               "ERROR_MESSAGE": null,

               "LAST_UPDATE_DATE": "2020-03-01T13:29:29.000Z",

               "LAST_UPDATED_BY": 0,

               "CREATION_DATE": "2020-03-01T13:29:29.000Z",

               "CREATED_BY": 0

           },

           {

               "CUST_GROUP_ID": 2,

               "CUST_GROUP_NAME": "Customer Group 2",

               "INSERT_FLAG": "Y",

               "RECORD_SENT_FLAG": "N",

               "ERROR_MESSAGE": null,

               "LAST_UPDATE_DATE": "2020-03-01T13:29:29.000Z",

               "LAST_UPDATED_BY": 0,

               "CREATION_DATE": "2020-03-01T13:29:29.000Z",

               "CREATED_BY": 0

           }

       ]

    }

    map is truncated, and ignore "data":[{ attrbutes.

  • Somesh Profile Picture
    55 on at

    Hi Martin,

    Thanks for the suggestion.

    I followed the below link and try to achieve it on Ax 2012 R3 only and it helped but the only confusion is, i am not able to achieve the multiple JSON string which i have described below.

    community.dynamics.com/.../1025796

    I have checked that out, and for json like following:

    {

    "success": true,

    "data": [

    {

    "CUST_GROUP_ID": 1,

    "CUST_GROUP_NAME": "Customer Group 1",

    "INSERT_FLAG": "Y",

    "RECORD_SENT_FLAG": "N",

    "ERROR_MESSAGE": null,

    "LAST_UPDATE_DATE": "2020-03-01T13:29:29.000Z",

    "LAST_UPDATED_BY": 0,

    "CREATION_DATE": "2020-03-01T13:29:29.000Z",

    "CREATED_BY": 0

    },

    {

    "CUST_GROUP_ID": 2,

    "CUST_GROUP_NAME": "Customer Group 2",

    "INSERT_FLAG": "Y",

    "RECORD_SENT_FLAG": "N",

    "ERROR_MESSAGE": null,

    "LAST_UPDATE_DATE": "2020-03-01T13:29:29.000Z",

    "LAST_UPDATED_BY": 0,

    "CREATION_DATE": "2020-03-01T13:29:29.000Z",

    "CREATED_BY": 0

    }

    ]

    }

    I am trying to create a job with below code

    .

    RetailWebRequest request;

    RetailWebResponse response;

    str rawResponse;

    RetailCommonWebAPI webApi;

    System.IO.Stream requestStream, responseStream;

    System.IO.StreamReader reader;

    Object deserializedContract;

    List list;

    ListIterator listIterator;

    CreateCustGroupContract custGroupContract;

    CustGroupList custGroupList;

    webApi = RetailCommonWebAPI::construct();

    request = RetailWebRequest::newUrl("URL");

    response = webApi.getResponse(request);

    rawResponse = response.parmData();

    custGroupList = new CustGroupList();

    listIterator = new ListIterator(custGroupList.parmDataDetail());

    while (listIterator.more())

    {

    custGroupContract = SMCFormJsonSerializer::deserializeObject(classIdGet(custGroupContract), listIterator.value());

    info(strFmt('%1', custGroupContract.parmCustGroupId()));

    info(custGroupContract.parmCustGroupName());

    listIterator.next();

    }

    but its only return "CUST_GROUP_ID": 1, "CUST_GROUP_NAME": "Customer Group 1".

    How can we achieve all the json string like "CUST_GROUP_ID": 1, "CUST_GROUP_NAME": "Customer Group 1", "CUST_GROUP_ID": 2, "CUST_GROUP_NAME": "Customer Group 2".

    Can you please help me to achieve the requirement.

    Thanks,

    Somesh

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

    It seems that in the other thread, you're trying to use a custom class developed by Ammar. Therefore please discuss it with him there.

  • Somesh Profile Picture
    55 on at

    Hi Martin, As Ammar is not responding and i am in mid of a critical work.

    Could you please help me here?

    Thanks,

    Somesh

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans