Accessing experimental features of xLocate server

This forum deals with any kind of web based client technology, whether it is the well known java script based Ajax servlet or the upcoming approaches such as Leaflet, OpenLayers and so on.

Accessing experimental features of xLocate server

Postby kgrudzinski » Tue Dec 06, 2016 12:53 pm

Hello,

Is there a way to access experimental features of xLocate server by means of XLocateClient? I could not find in documentation how to include xlocate-client.js.
kgrudzinski
 
Posts: 12
Joined: Fri Feb 19, 2016 10:56 am

Re: Accessing experimental features of xLocate server

Postby matthias » Tue Dec 06, 2016 1:13 pm

With the 2.0 Release of xServer it is unfortunatly not possible to access the experimental features using the deployed client. You will have to access it yourself using tools like jquery. See the documentation in section Developers Guide -> Using xserver with Javascript -> Generating clients. Make sure you use the experimental URL like http://your_server_ip:port/services/rs/ ... perimental.

The good news is that starting with the 2.1 release it will be possible to use the deployed client with experimental APIs! Then you can simply create the client like this:

var xlocate = new XLocateClient("experimental");

Best regards,
Matthias
matthias
 
Posts: 1
Joined: Wed Aug 06, 2014 8:39 am

Re: Accessing experimental features of xLocate server

Postby kgrudzinski » Thu Dec 08, 2016 11:26 am

I have a follow up question. I am using PTV xServer INTERNET so I replaced http://your_server_ip:port/ from Your answer with https://xserver2-europe-test.cloud.ptvgroup.com/ and I am getting 403 forbidden error. I suspect it is caused by bad authentication. I followed this example but it does not seem to work.
My code looks like this:
Code: Select all
var newSearch = function(locateUrl, text, token) {
      var url = locateUrl+'locations/'+text;
      
      $.ajax({
         url: url,
         type: "GET",
         headers: {
            "Authorization": "Basic " + btoa("xtok:" + token)
         },
   
         success: function(data, status, xhr) {
            console.log(data);
         },
   
         error: function(xhr, status, error) {
            console.log(error);
         }
      });
      
}

What is the proper way of authenticating my request?
kgrudzinski
 
Posts: 12
Joined: Fri Feb 19, 2016 10:56 am

Re: Accessing experimental features of xLocate server

Postby f.gailfuß » Thu Dec 08, 2016 4:07 pm

Basic authentication is used for POST requests; For GET requests, the token is simply provided through the request parameter "xtok" like this:

https://xserver2-europe-test.cloud.ptvgroup.com/services/rest/XLocate/locations/<search-text>?xtok=<your-token>

Best regards,
Frank
Frank Gailfuß
PTV GROUP Germany
f.gailfuß
 
Posts: 8
Joined: Fri Sep 16, 2016 8:02 am

Re: Accessing experimental features of xLocate server

Postby kgrudzinski » Fri Dec 09, 2016 10:38 am

Everything works now. Thank you for your help.
kgrudzinski
 
Posts: 12
Joined: Fri Feb 19, 2016 10:56 am


Return to PTV Webclients (Ajax, Leaflet, OpenLayers, WMS, ...) (Admin=LNM)

cron