1
votes

Here is the Microsoft Dynamics NAV Web Services from msdn. But I can only call http://<Server>:<WebServicePort>/<ServerInstance> and http://<Server>:<WebServicePort>/<ServerInstance>/ws/SystemService and http://<Server>:<WebServicePort>/<ServerInstance>/ws/services.

But I can't call the following: http://<Server>:<WebServicePort>/<ServerInstance>/WS/<CompanyName>/services http://<Server>:<WebServicePort>/<ServerInstance>/WS/<CompanyName>/Page/<ServiceName>

The URL for accessing a specific codeunit has the following elements:

http://<Server>:<WebServicePort>/<ServerInstance>/WS/<CompanyName>/Codeunit/<ServiceName>

How can I access Microsoft Dynamics Nav web services for each company from browser?

3

3 Answers

2
votes

From a browser you should be able to call:

http://<Server>:<WebServicePort>/<ServerInstance>/WS/<CompanyName>/Page/<ServiceName>
  • Make sure that SOAP & ODATA services is enabled for the ServerInstance.
  • Make sure that the Codeunit or Page is published and you got the correct published name.
  • Also note that CompanyName, Page, Codeunit, and ServiceName are all case-sensitive. As stated in https://msdn.microsoft.com/en-us/library/dd355398
1
votes

In the msdn page you linked to, it states that:

Special characters in the company name must be URL encoded. For example, spaces in company names must be replaced by %20, so you would encode the company name "Microsoft France S.A." as:Microsoft%20France%20S.A.Characters that are not part of the installed language should also be replaced. For example, in a US-English locale, the company name "CRONUS ÆØÅ Company" should be encoded as:CRONUS%20%C3%86%C3%98%C3%85%20Company

Did you verify that the company name you are using is properly escaped?

You can use the Uri.EscapeUriString method to escape your company name if you are building up the URI in .NET code.

0
votes

in the SystemService, there is a Function "Companies". Here you can obtain all the defined companies in the Dynamics NAV system.

By looping these you can call all the Webservices for all companies.

However, in the Services, you get an overview of all published webservices. Most of these work for all companies (except the systemservice)

In this case, you would place the escaped companyname as a "folder" between the WS and the Codeunit or the Page tag.

As such:

http://<Server>:<WebServicePort>/<ServerInstance>/WS/<CompanyName>/Page/<PublishedName>

or

http://<Server>:<WebServicePort>/<ServerInstance>/WS/<CompanyName>/Codeunit/<PublishedName>