Pages

Friday, 9 August 2013

Connecting to NAV Web Services from PHP part - 1



Here I will explain how to connect to NAV Web Services from php languages/platform. 


Scenario

For all these I will create some code that:
  • Connects to NAV Web Services System Service and enumerates the companies in the database
  • Constructs a URL to the Customer Page (based on the first company in the list)
  • Get the name of Customer number 10000
  • Get the Customers in GB that have Location Code set to RED or BLUE.
  • And Constructs a URL to the Codeunit methods.
Here is an example of the output of the PHP web site:

Note, that the code is not necessarily perfect PHP code and the intention is not to teach people how to code in these language to overcome some of the obstacles when trying to work with NAV.


Authentication

The very first obstacle is authentication. As you probably know, NAV 2009 only supported SPNEGO (Negotiate) authentication and PHP doesn’t currently have any support natively for that.
In NAV 2009 SP1 we added a key in the Service Tier configuration file called WebServicesUseNTLMAuthentication. If you set this key to true the Web Services listener will only use NTLM authentication and as such be easier accessible from other systems.
The config file you need to modify is placed in the directory where the Service Tier executable is and is called CustomSettings.config. The section you are looking for is:
    <!--
  Turns on or off NTLM authentication protocol for Web Services
      false: Use SPNEGO (recommended)
      true: Use NTLM only
  -->
    <add key="WebServicesUseNTLMAuthentication" value="true"></add>

Note that .net works with both values of this settings.



Note:
Here I collecting the information from Freedy and Arte blogs. They are explain the two different ways here I explain the both scenarios.

any queries welcomes you...

No comments:

Post a Comment