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)

Consume AIF inbound port from Java application

(0) ShareShare
ReportReport
Posted on by 2,894

Hi, I've used AIF inbound ports with a C# application, however I've been requested to do the same using Java, but I'm not sure how to start, do you know how to accomplish this task? I guess I could use a WSDL path of the WCF service, but the only thing I got from AX is the WSDL URI, which is just a URL. I would appreciate your help, thank you.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Dynamics AX 2012 AIF services are WCF services

    Please go though following link by Vishal Gilbile

    www.c-sharpcorner.com/.../consuming-a-wcf-service-in-java-application

    this is a good link and explains how to consume WCF services using JAVA application

    thanks to Vishal Gilbile

  • saman0suke Profile Picture
    2,894 on at

    Thanks a lot for the help.

    I was actually looking at that thread, however I always notice that when you are creating the web service client at java's side, there's always a URL like:

    http://localhost:port_number/?wsdl

    But in AX the WSDL URI is just:

    http://localhost:port/Services/Inbound_port_name

    Without the wsdl and it just hangs with the message: Could not retrieve the WSDL file. I know I might be lost with something there, I would appreciate your feedback, thanks.

  • Suggested answer
    Community Member Profile Picture
    on at

    Please read following link to find out WSDL for Dynamics AX AIF services

    technet.microsoft.com/.../gg843514.aspx

    Which I think same as you have the AX WSDL URI

    Can you please validate if you have the access to the port and server from your java application

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

    Open the URL in a web browser - WSDL is just a special XML file, so you can see it in that way. If you get the WSDL, you'll know that the problem is not in the URL.

    Also try using server's name or IP instead of localhost.

  • saman0suke Profile Picture
    2,894 on at

    Instead of trying to use a basic inbound port, I created an enhanced HTTP port in AX, and added an operation (as test) that returns an ItemId from the InventTable, which is basically a string right? that gave me the WSDL URL, I created a web service client in Netbeans, and it created a bunch of classes and seems like everything is working so far, I'm trying to get the ItemId in a java application that I created as well, and in the main method, this is what I have:

    public static void main(String[] args) throws IOException {
    // TODO code application logic here

    }

    private static JsEMTestServiceGetItemIdResponse getItemId(WS.JsEMTestServiceGetItemIdRequest parameters) throws JsEMTestServiceGetItemIdAifFaultFaultFaultMessage {
    WS.RoutingService service = new WS.RoutingService();
    WS.JsEMTestService port = service.getBasicHttpBindingJsEMTestService();
    return port.getItemId(parameters);
    }

    GetItemId is my method, but the code generator in NetBeans added a parameter of type WS.JsEMTestServiceGetItemIdRequest, and I did not setup any parameter in AX, how should I call my method then? or did it create the whole structure of the web service incorrectly? I would appreciate your help, despite the fact that this is not a java forum.

    I was wondering, would it work if I create a web service project in C# to connect to AX, publish it in IIS and then read that one from my Java project instead?

    Thanks!

  • Suggested answer
    AXT Profile Picture
    1,699 on at

    This is called a wrapper class. Every wrapper class corresponds to a SOAP message that you can see in your WSDL. So if your service has three methods you have six wrapper classes, two for each method (request/response). Your parameters  are wihtin the wrapper class as JAXBElement's and accessible with getter/setter. To create JAXBElements you can use Object factories created by wsimport. To get parameter value from a JAXBElement use for example:

    String name = jaxbElement.getValue();

    Take care about implicit SOAP headers, e.g. CallContext. To get CallContext in your method signature 

    @WebParam(name = "CallContext", targetNamespace = schemas.microsoft.com/.../datacontracts", header = true, partName = "context") CallContext context)

    you have to use wsimport with option -XadditionalHeaders.

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
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans