Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've been experimenting with OSM2PO which is a great little peace of software. Right now though, I'm fumbling with the SOAP WS which I'm trying to use from a JEE web application. I'm not having any trouble to setup the call to the webservice and can call upon one of the two webmethods described in the WSDL : findClosestVertexId() and findRoute(). Finding a close-by vertex ID from coordinates is no trouble at all but calling findRoute() is somewhat puzzling me as it takes four parameters : the two start and end points of the route and - RouterID (integer) and parameters (String). My question is : what do I put in those last two? I'm asking because actually I'm not getting anything from findRoute(). I've been trying something like findRoute(myStartVertexID,myEndVertexId,1,"") but the List I get is desperatly empty (getLength() returns 0!). I'm guessing this is because I'm misusing the findRoute() method and not putting proper parameters in the method call.

Anybody experiencing the same problem?

share|improve this question
add comment

4 Answers

public RoutingResult findRoute (
        @WebParam(name="sourceId") int sourceId,
        @WebParam(name="targetId") int targetId, 
        @WebParam(name="routerId") Integer routerId,
        @WebParam(name="params") String args) {
  1. sourceId: Id of Source-Vertex
  2. targetId: Id of Target-Vertex
  3. routerId: Optional - Id of Router-Implementation (Have a look into the osm2po.config. 0 is the DefaultRouter)
  4. args: Optional - Komma-separated list of additional string-args for the Router-Implementation. e.g. "findShortestPath=true,ignoreRestrictions=false"

On a lighter note: Why do you use the SOAP-Interface anyway? It's easier to utilize osm2po directly - as Java-Lib.

share|improve this answer
add comment

Thanks Carsten, it does clear things up a bit. However I must say that "routerID" and "params" are not optional - not at least with the auto-generated code from netbeans based on the WSDL. Since I'm not your everyday SOAP Guru, I might be missing a thing or two and I only use SOAP with tons of automated stuff in netbeans. Anyways, everything works fine now.

I wanted to try the SOAP interface because I don't feel so comfortable with having to open and close the graph file myself - I dread concurrent access problems to the graph file...I figured you'd have prepared something nice on the SOAP code side of things, without having me to worry about it. But you are right I guess, it's probably better to use it as a lib and besides, it can then be used in a servlet container or JEE compliant server.

Then again, if I use it in a web-app, I'll be delivering a routing service through SOAP and/or REST WS, so maybe that's another reason I went for the SOAP interface - already done (and I do tend to be lazy at times...).

Anyways, thanks for your quick answer which helped a lot, and thanks for Osm2Po!

share|improve this answer
    
It depends on the generator framework. ADB e.g. is not able to transport Integer.NULLs. Here you must use Integer.MINVALUE instead. With JaxWS or JAXB it is possible. In SOAP-UI you can delete both parameters - you can even delete the entire tag-line. –  Carsten Oct 10 '12 at 15:58
add comment

To get an idea how a servlet might look like:

osm2po in a servlet container

share|improve this answer
add comment

Thanks a lot. The few lines in the given example, below the comment "// graph: lazy, cached, auto closed", are a relief (never been at ease in dealing with files...too many bad memories)!

Agreed then, I'll try using Osm2po as a lib instead of going with the SOAP service.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.