Starting with xRoute WS

This forum deals with any kind of routing computation whether it is simple A:B-routing, calculation of isochrones, simple matrix computation or nearest search.
ffw_rude
Posts: 7
Joined: Mon Feb 20, 2017 2:56 pm

Starting with xRoute WS

Post 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 ?
User avatar
Bernd Welter
Site Admin
Posts: 2572
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Starting with xRoute WS

Post 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"
      }
    ]
  }
}
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
ffw_rude
Posts: 7
Joined: Mon Feb 20, 2017 2:56 pm

Re: Starting with xRoute WS

Post 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
User avatar
Bernd Welter
Site Admin
Posts: 2572
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Starting with xRoute WS

Post 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
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
ffw_rude
Posts: 7
Joined: Mon Feb 20, 2017 2:56 pm

Re: Starting with xRoute WS

Post by ffw_rude »

That's the deal though :)

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

Re: Starting with xRoute WS

Post by Flegregeois »

Hello there,

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

best regards, François
ffw_rude
Posts: 7
Joined: Mon Feb 20, 2017 2:56 pm

Re: Starting with xRoute WS

Post 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 :(
Flegregeois

Re: Starting with xRoute WS

Post 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
ffw_rude
Posts: 7
Joined: Mon Feb 20, 2017 2:56 pm

Re: Starting with xRoute WS

Post by ffw_rude »

I don't call a URL i call a function.

I don't get your question.
Flegregeois

Re: Starting with xRoute WS

Post 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
Post Reply