How to: Set Up Web Services
This topic is a quick overview of how Web Services are handled, mainly based on screenshots.
Introduction
Web Services share the same configuration menu as the Transaction Server Functions, along with having similar attributes. The main difference there between is:
- Transaction Server uses Data Director
- Web Service uses the built in Business Central Web Service.
What they have in common is that they are both used for pushing and querying information to a remote Database/Company.
Additionally Web Services have the capability to:
- Run Objects at remote destination
- Working with Flow Fields (in pre-NAV2013 Transaction Server also had this capability). Because of this, some Web Requests are Mandatory and cannot be disabled.
Web Services Functions
The blue numbers next to each function represents the Web Service Requests that are in use. It is possible to enable a Trans. Server Function to use Web Services for some request and Transaction Server for the rest.
Setting up Web Services
Is the Web Service Running?
Are the RetailWebServices enabled?
Distribution Location
We will need to configure and construct the connection string to the remote Database.
The required fields are outlined in blue and the red outlined field is the connection string which is constructed automatically. In case Business Central is configured to use other authentication methods than current Windows Login, you can also specify user and password.
The URL is constructed as follows (example):
http://SERVICE_TIER_HOSTNAME:PORTNUMBER/SERVICENAME/WS/COMPANYNAME/Codeunit/RetailWebServices
To test the connection open a browser with the web services URL. Is the output similar to the image below? If not, something is not working correctly.
Defining the Web Server
Select the Local Request check box if you want the Web Service to push and query information from the Local Database (itself). This is useful when you want to use Web Service Mandatory Functions locally. For example, querying for a Member Account which exists on the POS Database instead of the HO. If used in conjunction with the field Priority, then an example of a scenario could be as follows:
Try first to receive Member Information from HO, if unsuccesfull retrieve information from Local Database.
Example of use
In this scenario we have the following Web Service Functions in use at a POS Database:
- At the time of posting/paying transaction on POS -> Push the Transaction Record to HO
- At the ime of retrieving a Transaction to be Voided -> Lookup and retreive the record from HO
- At the time of Voiding the Transaction which was acquired earlier from HO -> Update the record in HO
- At the time of looking up and retrieving customer information -> Lookup and retreive the record from HO, if connection fails then use the record from P0001.
The Web Service Requests can give a good hint on the actual processes that the Web Services will be using. Accessed by drilling down to the blue numbers.
Further considerations
Initial Setup
In the Web Service Setup page you can activate or deactivate the web service module. If no request exist in the WS Request table when you activate the system will create all the default requests.
Monitoring and debugging
Web Services do not have a Job Monitor as the Data Director has. However you can make use of the Client Log for monitoring and debugging purposes.
Note: The output files are big (around 1-2 Mb each) and should therefore only be used in a controlled environment for testing and debugging purposes.