I am accessing ArcGIS Server REST API geometry server in a Java application to do some analysis. I expect to be buffering lines and polygons and plan to use a post request due to the length restrictions on a 'GET' request. I have structured my HttpRequest's endpoint and body correctly and verified my response using Postman v5.2.0 which is powered by Asp.Net.
I am using Java to make requests to the geometry server. When I make a geometry server buffer request from my Java application, I get a 200 status. However, the response from the server is not a buffer response. Instead, my response is the HTML form from the buffer tool's endpoint. I.E. :
<link href="/arcgis1/rest/static/main.css" rel="stylesheet" type="text/css"/>
<table width="100%" class="userTable">
ArcGIS REST Services Directory
<td align="right"> .......
I did a quick internet search and found a related post on esri's resource-proxy's GitHub page: POST to geometry service for 'PROJECT' is returning HTML instead of JSON · Issue #332 · Esri/resource-proxy · GitHub
Is this issue on the resource-proxy GitHub site related to making REST endpoint POST requests from a Java application?
The Java code that I am using to perform the POST request is:
Http httpProtocol = new Http();
HttpRequest request = new HttpRequest();
String reqBody = 'geometries=-78.868242630049537,35.773265772338988&inSR=4326&outSR=4326&bufferSR=102113&distances=1000&f=json';
Integer bodyLength = reqbody.length();
request.setHeader('Content-type', 'application/json' );
HttpResponse response = httpProtocol.send(request);
system.debug('response.getBody(): ' + response.getBody());
system.debug('response: ' + response);
Has anyone else had this issue or know of a work around? Any help or suggestions will be greatly appreciated.