Services
older version
Klopt web services are running on port 6660 by default. This was 8812 in the past but since the services have been split they run at their own port 6660 and upwards, where 6660 has a dispatching task.
If used as an apache web service, use the scripts post.php and get.php for POST and GET requests. These will be converted directly into sockets calls to the server on the 6660 address.
These scripts are php. Here is the rough outline of get.php, the post.php version is scarcely different : it used POST instead of GET, and a larger read.
As of 7 June 2014 a new script is in fact operational, which works with wsgi, it is called ws.wsgi. So the above script can be called obsolete for most newer tests.
services troubleshooting
It can be somewhat obscure on what goes wrong when the one end (website) does not work with the other site (services). Here is a description on how to get information on what is wrong. We are taking the route web -> -> -> services here but don't hesitate to reverse that path, of better test where your suspicions are.
Since the new services are installed with ansible, it might be worthwhile the also create a test script that diagnoses what went wrong.
Until then ...
We advise to start with a simple service like nearestdemo first and progress onto tspdemo later.
Calling script
First of all we assume the apache server is running and you see the web site and demo's page. First thing that can go wrong is you click on a demo and the map does not show. This is usually a problem with the API key, best in this case is to use chrome and hit ctrl-shift-i to open the development console, on the console tab you will get a lot of information on the problem.
no functionality
Keep the dev console open if possible, now click somewhere on the map, which is in almost all demo's has a function. If it does nothing first watch the dev console for clues. Otherwise go to the webpage you see in the address bar and enable the alert box by changing lines like :
| changetitle | |
|---|---|
into :
| changetitle | |
|---|---|
Sometimes there are more of these, for instance to get coordinates and then get a route. Choose which or all of them you need to monitor. This will show an alert box with the parameters being sent and what the called script returned.
Note : you should find out what service is called by context.post_sync() it could be post.php, get.php or ws.wsgi, you can find it at the creation of the AjaxContext.
the script called
It is advised to stop using the php scripts and use wsgi, so i am going to concentrate on that. It has a logging capability that logs to /var/log/apache2/err.log. Look in there for evidence, there is only minimal logging normally so you could add lines like :
| changetitle | |
|---|---|
Actually, this line :
| changetitle | |
|---|---|
Also ends up in /var/log/apache2/error.log.
You can also test the script detached from the web site with the resteasy client of chrome, i enabled it on my desktop for ease. Don't know where to find it otherwise actually.
Fill in in the url window :
| changetitle | |
|---|---|
Choose POST. And add the string from the web page ("message to the server") into the body window. Now hit send. It will either work or give more clues to what's wrong.
script works but website does not
If you tested the ws.wsgi script but still no result, you are back to the dev console, it should give some error about the result. For instance
| changetitle | |
|---|---|
If you click on the line nearestdemo.html:202 next to it, you will be taken to the source and error. But changes are you can't view the variable contents to examine it. Best is to add a console.log message for the variable you want to examine and run again.