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

Consuming External Web Services in X++

(0) ShareShare
ReportReport
Posted on by 311

We are doing the Integration with the Bank for Electronic payments & bank has provided the Web service API (WSDL URL), we are using the AX 2012 R3 CU12 Environment

My question is

  • Do we need to generate the XML in X++ using XmlDocument & XmlElement and pass the generated XML to Web service
  • how to capture the response, i.e. the acknowledgement
  • OR do we need to write the code in C# to generate the XML
  • What is the best approach to do the integration

If possible can you support your suggestions with sample code or articles, that will be very helpful  

 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    Hi Vinayak Chingunde,

    You can generate service reference using visual studio and then use it in AX , please refer to this blog post for example

    community.dynamics.com/.../consuming-a-web-service-in-ax-2012-is-easy and to technet article technet.microsoft.com/.../hh500185.aspx

  • Verified answer
    Martin Dráb Profile Picture
    237,990 Most Valuable Professional on at
    1. No, you normally don't have to and shouldn't manipulate any XML; there even doesn't have to be any XML involved (it's just one of possible ways for serializing data for transfer over network). Visual Studio can read the WSDL and generate classes representing the data contract and handling all communication. Therefore all your code will use classes as usual in OOP.
      The exception would be if the bank returned a string value containing XML, which usually means a bad design.
    2. You call a method of the proxy class and get an object as the response.
    3. Again, no XML. You add a service in Visual Studio and then use the classes.
    4. There is no single best approach. It all depends on situation.

    Look at Technet: Walkthrough: Calling an External Web Service from X++ [AX 2012].

  • Vinayak Chingunde Profile Picture
    311 on at

    Hi Martin,

    I have followed below steps

    1. Created VS Project > added web service reference > Added to AOT
    2. Created a Job > created all objects related to Payment service, ex. WebAPI_PayRequest
    3. I am not getting any set_Variable() methods or calling passing any parameters to methods
      1. like request.set_Query("Dynamics AX"); // Note the search request string is “Dynamics AX” from example https://technet.microsoft.com/en-us/library/hh500185.aspx

    Can you please suggest where I can find those set_variable() methods, I know I am asking for some thing which is very specific & it also differs API to API. I am struggling from last 2 days, if possible you can guide me the way.

    OR 

    You can suggest me what questions I should ask to the Bank IT Team.

  • Verified answer
    Martin Dráb Profile Picture
    237,990 Most Valuable Professional on at

    request must be an instance of the .NET proxy class generated by adding the service reference. In the example from Microsoft, request is an instance of BingSearch.ServiceReferences.BingV2ServiceReference.SearchRequest.

    Also, make sure that the VS project is configured to be deployed automatically. Because you normally run such code on server side (and therefore you'll deploy it to AOS), you must run your X++ code on server as well (which isn't the case of jobs).

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans