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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to consume Dynamics AX Web Services in PHP?

(0) ShareShare
ReportReport
Posted on by 1,813

Hii,

We have a Human Resources system developed in PHP and this system processes payroll.

The requirement is to integrate PHP based payroll system with Dynamics AX 2012 R2.

When HR create payroll in PHP based system, it should create a journal with all lines, account, dimensions and amount in AX -> GL -> General Journal.

Then an accountant should review auto generate journal and post it in AX.

There is inbound LedgerServices and I tested in ASP.Net web page and I can create journal header and lines. Its ok with ASP.net.

Please guide how I can consume inbound LedgerServices WSDL with PHP in our PHP HR system.

Best Regards,

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    239,660 Most Valuable Professional on at

    PHP offers SoapClient class for consuming SOAP web services. You can looks at PHP-related resources to find more information about it.

    Also may also want to look at older discussions in this forum; I'm sure that SoapClient was mentioned here before.

    Note that WSDL is just a language describing services, not the service itself.

  • Rana Anees Profile Picture
    1,813 on at

    One of very experienced AX consultant suggested following options,

    1. From PHP export to CSV / XML and get it consumed in via AIF.
    2. Export in CSV / XML and use windows service to move it in AX.
    3. Create temp table in AX and dump data from PHP to temp table. In AX batch job to move that data into actual tables.

    need further opinions...

  • Martin Dráb Profile Picture
    239,660 Most Valuable Professional on at

    I was answering your question "How to consume Dynamics AX Web Services in PHP?" and "how I can consume inbound LedgerServices WSDL".

    If you've changed your mind and you want use file-based exchange instead of the web service, it's of course a possibility (but it's clearly a different topic).

    Writing to AX database from external sources is highly discouraged; it would also require direct connection from the web application to your ERP database (which often isn't possible) and giving thee web applications permissions to do that.

  • Verified answer
    Rana Anees Profile Picture
    1,813 on at

    We found a solution and its working with us.

    There is a library that lets you make HTTP requests in PHP. Its name is cURL
    cURL is a way you can hit a URL from your code to get a html response from it. cURL means client URL which allows you to connect with other URLs and use their responses in your code.

    How we are doing this. We have created ASP.Net web application and added service reference of AX inbound LedgerServices in it.
    On default.aspx page button click write code to create Journal Header, Lines and Dimensions with hard coded values for testing. Later on make a method for creating Journal and call it on Page Load. Take care of page refresh. Then host the app on IIS and it could be on different server on same domain. Make sure you can create journal from your ASP.Net web app.

    Now the rest thing is our PHP page is calling ASP.Net web page url and sending it xml request containing complete journal header, lines and dimension values through cURL. In our ASP.Net by using Request.InputStream to get request from PHP and putting the values in Dataset ds.ReadXml(Request.InputStream).
    Replace the hard coded values with Dataset object. It is creating the journal successfully.  
           

  • Martin Dráb Profile Picture
    239,660 Most Valuable Professional on at

    The approach of using a middle-tier web service to abstract from certain details is very common, but I think you would be a better off if you created a proper RESTful web service instead of a traditional web page.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 21

#2
Harisgillani Profile Picture

Harisgillani 4

#2
dekion Profile Picture

dekion 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans