Page 1 of 2

Starting with xRoute WS

Posted: Mon Feb 20, 2017 3:02 pm
by ffw_rude
Hello,

So i just been handed xRoute to play with and it's quite complicated to start.

I'm trying to use xRoute WS with calculateBulkRouteInfo but so far impossible to make it work and impossible to find documentation.

I'm trying to call it via PHP and i don't know how the data needs to be formated. I tried mimicing the exemple code with php arrays but so far no dice.

To make it real simple here is what i'm trying to do :

Code: Select all

<?php
$wsdl = "my_wsdl_url";
$service = new SoapClient($wsdl);
$answerMe = $service->calculateExtendedRoute($array);
var_dump($answerMe);
?>
I tried various format for the array but i just can't figure out where to look to have an answer. So for now i'm stucked with "Waypointslist should contain at least two waypoints".

Can someone point me in the right direction ?

Re: Starting with xRoute WS

Posted: Mon Feb 20, 2017 3:12 pm
by Bernd Welter
Hi there,

Here's a proper sample JSON request taken from the management console.
Unfortunately I don't speak PHP therefore I can't tell you how to create the array in this language.
But you may find further samples dealing with PHP at
http://xserver.ptvgroup.com/it/cookbook ... -examples/

Best regards Bernd

Code: Select all

{
  "waypoints": [
	{"coords": [{"point": {"x": 681013,"y": 6371680}}],"linkType": "NEXT_SEGMENT"},
	{"coords": [{"point": {"x": 685903,"y": 6372958}}],"linkType": "NEXT_SEGMENT"},
	{"coords": [{"point": {"x": 680013,"y": 6370680}}],"linkType": "NEXT_SEGMENT"},
	{"coords": [{"point": {"x": 685903,"y": 6372958}}],"linkType": "NEXT_SEGMENT"},
	{"coords": [{"point": {"x": 676437,"y": 6448604}}],"linkType": "NEXT_SEGMENT"},
	{"coords": [{"point": {"x": 685099,"y": 6416093}}],"linkType": "NEXT_SEGMENT"},
	{"coords": [{"point": {"x": 660301,"y": 6427670}}],"linkType": "NEXT_SEGMENT"}],



  "options": [],
  "exceptionPaths": [],
  "callerContext": {
    "properties": [
      {
        "key": "CoordFormat",
        "value": "PTV_MERCATOR"
      },
      {
        "key": "ResponseGeometry",
        "value": "PLAIN,WKB"
      },
      {
        "key": "Profile",
        "value": "truckfast"
      }
    ]
  }
}

Re: Starting with xRoute WS

Posted: Mon Feb 20, 2017 3:15 pm
by ffw_rude
Hello and thanks for your answer.

Regarding the JSON method, i thought this couldn't be achieved via SOAP and only by REST. On my PTV Server i don't have documentation for the JSON/REST method so i let this out. Do you have documentation for the communication between JSON/REST on xRoute ?

I'll look into the code exmples though.

But let's say i know how to encode this json request.

How do i call the WS ? Because that's something i don't see nowhere in the documentations

Re: Starting with xRoute WS

Posted: Mon Feb 20, 2017 3:40 pm
by Bernd Welter
Hi there,

there's some generic info in the docu:
http://xserver.ptvgroup.com/fileadmin/f ... e%7C_____1

Once you checked how to establish communication with a service we can probably help more goal oriented with the module's functions. I recommend that you get in touch with your local PTV consultant to check how to get a kick-start.

Best regards Bernd

Re: Starting with xRoute WS

Posted: Mon Feb 20, 2017 3:53 pm
by ffw_rude
That's the deal though :)

"Once i checked how to establish communication" is exactly what i'm looking for :)

Re: Starting with xRoute WS

Posted: Mon Feb 20, 2017 8:43 pm
by Flegregeois
Hello there,

which method did you try to call within xRoute and which URL did you use?

best regards, François

Re: Starting with xRoute WS

Posted: Tue Feb 21, 2017 8:44 am
by ffw_rude
The $wsdl ? It's

http://XXX.XXX.XXX.XXX:XXXXX/xroute/ws/XRoute?WSDL

Then i tried calculateBulkRouteInfo AND calculateExtendedRoute

Since late yesterday i'm able to call the WS via curl but not in PHP :(

Re: Starting with xRoute WS

Posted: Tue Feb 21, 2017 1:38 pm
by Flegregeois
Hello,

not only the URL of the WSDL, but when you want to call the method calculateBulkRouteInfo OR calculateExtendedRoute, which URL did you use?

it should be something like :

http://XXX.XXX.XXX.XXX:XXXXX/xroute/rs/calculateBulkRouteInfo

Re: Starting with xRoute WS

Posted: Tue Feb 21, 2017 3:01 pm
by ffw_rude
I don't call a URL i call a function.

I don't get your question.

Re: Starting with xRoute WS

Posted: Tue Feb 21, 2017 3:14 pm
by Flegregeois
yes, but first you need to configure an URL so that the function know where is the xServer and which protocol to use (SOAP or REST). So which URL did you configure? if it an URL with ?WSDL at the end, it is not good: you will just have the WSDL as an answer.

best regards