I wanted to replace MySQL with NAV Web Service as a data source for my PHP web site.  I started to look around and found all I needed in Freddys Blog.  First post is about changes in authentication method of the web service, the later post displays the code needed to connect to the web service with php.

I have an php web on my Windows Home Server and needed to activate two more extensions to get things working.

Here are the php files that I used – PHP consume NAV Web Service

14 thoughts on “NAV Web Service and PHP

  1. Mouli Kaku says:

    Hi I have a problem while connecting navision webservice outside the domain could you please help me out in achieving this

    thnk u

  2. Did you change the authentication of the web service?

  3. Mouli Kaku says:

    Hi Gunnar,

    sorry for the delay in my response.

    Yes I changed the authentication but the problem with my firewall and now it is working fine build a proxy server using PHP and now working on integrating with Android app and another PHP application.

    Indeed ur post is a great help for me. Thank you!!

    Regards
    Mouli.K

  4. Michiel says:

    Is this still working with NAV 2015?

    1. Yes Michiel, it sure is still working in NAV 2015.

  5. Michiel says:

    Gunnar thanx for the reply, I keep getting the same error do you have any idea what causes this?

    When i run the script I get this error:

    PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn’t load from ‘https://xxxxxx.navonazure.com:7151/PW-Productie/WS/SystemService’ : Start tag expected, ‘<' not found
    in E:\wwwroot\Finance\navphptest.php on line 26
    PHP Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://xxxxxxx.navonazure.com:7151/PW-Productie/WS/SystemService&#039; : Start tag expected, 'SoapClient(‘https://xxxx…’)
    #1 {main}
    thrown in E:\wwwroot\Finance\navphptest.php on line 26

    When I go to the same URL in a browser, and use the same credentials I get a WDSL back….

    ……….

    I am running PHP 5.5.11 on Windows, also tested on Linux

    Thnx in advance

    Michiel

    1. Hi Michiel.
      Are you using XMLPorts in your SOAP service ?
      Did you make sure that the Format property is XML and the UseDefaultNamespace is TRUE ?

      1. Michiel says:

        GUnmar, I user Navonazure, so I can not check those settings. For now I only try to connect with your standard script, so is that with XMLPorts? I the license model of NavonAzure I see an additional option you can buy (100 pack XMLports) maybe I also need to buy that.

        1. Michiel says:

          Gunmar, I continued testing, I can connect and get a response from the environment when I use SoapUI with NTLM. But when I use this PHP script I keep getting the same error (see above)

          Please help

          1. Hi

            This example is working on Pages published as Web Services.

  6. pigeonseeker says:

    Hi Gunnar,

    I have done several PHP app that connect to NAV webservice with no problem.
    Now I have a customer with NAV 2015 running on AZURE. I thought it will be just the same, until I encountered this familiar error:

    Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn’t load from : Start tag expected, ‘<' not found in D:\home\site\wwwroot\

    I have fix the same error so many times with the same solution. But now I don't know what to do anymore. The error still occurred.

    I even try the solution on this blog:
    http://blog.artea.info/ms-nav-web-services-tofrom-php-receiving-and-sending-data/

    But the result is just the same.

    Maybe its because of the AZURE? I have no idea.
    Please advice.

    1. barthdesade says:

      Had the same issue. Looked for a solution for hours, but didn’t find any. Obviously the fault is within NTLM somewhere. I tried the Odata instead (https://github.com/OData/odata.net/issues/471) and that did the trick to access, modify and delete the data. Still it didn’t let me to access codeunits so the logic needed to be on the PHP side, which was not ideal as I had nice codeunit written which worked well on non-azure server where I had the test environment.

  7. Anja says:

    Hello,

    i have a problem and I am a beginner in PHP.

    I have a website and I want to get the Information from Navision in there.
    I already create a page and published it.

    But i can’t connect it with PHP. Do you have a simple example, how to connect to Navision from PHP.

    Thank you.
    Greetings
    Anja

    1. Look for Freddy’s blog @Microsoft. You will see examples on how to connect to NAV from PHP. Just remember to use the NavUserPassword authentication method in NAV and Basic Authentication method in PHP

Leave a Reply

%d bloggers like this: