Page 1 of 1

Samples and Clients for xServer2 (Java)

Posted: Thu Feb 22, 2018 8:55 am
by Bernd Welter
Hello there,

a customer of mine wants to connect to xServer INTERNET via Java. Two simple questions:
  • Where do we provide the Java client classes on our website? In other words: where are integrators without an on premise version supposed to find client classes? I found this ressource but that's really tricky to spot.
    Screenshot taken from <br />https://xserver2-europe-eu-test.cloud.ptvgroup.com/dashboard/Default.htm#DevelopersGuide/DSC_UsingWithJava.htm%3FTocPath%3DDeveloper's%2520Guide%7C_____4
    Screenshot taken from
    https://xserver2-europe-eu-test.cloud.ptvgroup.com/dashboard/Default.htm#DevelopersGuide/DSC_UsingWithJava.htm%3FTocPath%3DDeveloper's%2520Guide%7C_____4
  • Do we provide some sample code including the authentification part (remote URL , network credentials) in Java?
Best regards,
Bernd

Re: Samples and Clients for xServer2 (Java)

Posted: Thu Feb 22, 2018 10:14 am
by Bernd Welter
Hi there,

I assume this is the missing link:
Screenshot from the upcoming documentation (thank you, Marco)
Screenshot from the upcoming documentation (thank you, Marco)
It shows how to set username and token via our JAVA clients.

Code: Select all

String host = "https://xserver2-europe-eu-test.cloud.ptvgroup.com/services/ws/XRoute";
	XRoute client = (XRoute) new XRoute_Service(new URL(host)).getXroute();
      
	// Set the token via basic authentication      
	BindingProvider prov = (BindingProvider)client;
	prov.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "xtok");
	prov.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "<your xServer-internet token>");
        
	client.calculateRoute(
	...
Best regards,
Bernd