I am developing with ArcGIS REST API Vehicle Routing Problem service.
When I sent the request using HTTP GET method, I got the 414 error as the URI was too long. (I requested with 11 routes and 238 orders data.)
So I changed to POST method. Then I could get jobId.
However, when I used the jobId to request the solution with output parameters (out_stops, out_routes, out_directions, out_unassigned_stops and solve_succeeded
), I got the errorMessage
"Unable to complete operation"
Then I POSTed the request with less data that could be solved successfully using GET method before, but I still got the errorMessage "Unable to complete operation"
.
Does it mean ArcGIS REST API Vehicle Routing Problem service does not accept HTTP POST method?
Here is my HTTP request URL:
https://logistics.arcgis.com/arcgis/rest/services/World/VehicleRoutingProblem/GPServer/SolveVehicleRoutingProblem/submitJob?token=&orders={...}&order_pairs={...}&depots={...}&routes={...}&breaks=&time_units=Seconds&distance_units=Kilometers&uturn_policy=NO_UTURNS&default_date=1465394400000&time_window_factor=High&f=json
I use java Jersey2.x client to do the POST request.
Client client = ClientBuilder.newClient();
WebTarget target = client.target("https://logistics.arcgis.com/arcgis/rest/services/World/VehicleRoutingProblem/GPServer/SolveVehicleRoutingProblem/")
.path("submitJob");
Form form = new Form();
form.param("token", problem.getToken());
form.param("orders", ordersRequestParameter);
form.param("order_pairs", orderPairsRequestParameter);
form.param("depots", depotsRequestParameter);
form.param("routes", routesRequestParameter);
form.param("breaks", breaksRequestParameter);
form.param("time_units", "Seconds");
form.param("distance_units", "Kilometers");
form.param("uturn_policy", "NO_UTURNS");
form.param("default_date", "1465394400000");
form.param("time_window_factor", "High");
form.param("f", "json");
String jobIdResponse = target.request(MediaType.APPLICATION_JSON_TYPE)
.post(Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE), String.class);
-
I think it's more likely that your POST encoding is incorrect. Try creating an echo proxy to display the actual content with flags, the compare your data content with a manual invocation of the serivce through the ArcGIS Manager interface.Vince– Vince2017年08月31日 11:48:57 +00:00Commented Aug 31, 2017 at 11:48
-
That's true, @Vince . I checked it again and then found that the URL had been encoded twice. After I modified the request parameters, it worked. Thanks.Z Li– Z Li2017年09月01日 03:07:32 +00:00Commented Sep 1, 2017 at 3:07
1 Answer 1
The reason for the problem is request parameter encoding incorrectness. After modification, I got the result successfully. So, you can use HTTP POST method to request ArcGIS REST API Vehicle Routing Problem service.
Explore related questions
See similar questions with these tags.