Layer Service Provider
After registering a layer on the publishing site , the key to make a layer work is to set up a web service. This web service needs to communicate with the layar server and generate appropriate getPOIs response based on Layar Developer API . In this section, we will walk through the essential steps in setting up this web service.
What's needed?
The following elements are needed to in setting up the web service:
- A public web server (reachable via the internet) to host this web service.
- A database which can be used to store POI information and other data needed in the layer, such as sessions, usernames, passwords (if your layer lets users log in). This database should be hosted on a public web server as well, normally the same web server where the web service is hosted.
NOTE: web server hosted on localhost does not work, since the web service needs to communicate with Layar Server.
How to set up the connection with Layar Server ?
To get a general idea about the Layar platform, please check out Layar Platform Architecture Overview first. The general flow is as follows:
- Create a web service on a public web server
- While creating a layer on the publishing site, fill in "the API endpoint URL" field with the URL to the web service.
- Whenever this layer is launched, a GetPOIs request is sent to your web service.
- Based on the parameters specified in the GetPOIs request, the web service needs to provide a valid JSON response according to the Developer API , such as POIs information.
- The Layar server validates the response and passes the JSON response to the Layar client.
- The JSON response (such as spots information) is interpreted and shown in the Layar client on the phone.
How to write a layer web service ?
A layer can be written in various programming languages, as long as the response is in JSON format.
- For sample codes on writing a layer web service, please visit the Tutorials section.
- To get a good understanding about the parameters in GetPOIs request / response, please visit theAPI documentation section.
- For troubleshooting assistance, please check out FAQ first.
- If you still have questions, please do not hesitate to post a thread in developer support environment. Layar technical support staff and the whole developer community are there to help you out.
- There are also many third party tutorials and tools that can help ease your layer development.