proxy.jsp for edit the point feature

2129
8
10-31-2011 12:15 AM
shwetakunjadia
New Contributor
Hi All,

Please someone help me i got this script error while edit the feature and wont be able to update.

"NetworkError: 500 Internal Server Error - http://localhost:8080/app/proxy.jsp?http://server:8399/arcgis/rest/services/app2/FeatureServer/1/app..."

Error: Unable to load proxy.jsp?http://server:8399/arcgis/rest/services/Sapp2/FeatureServer/1/applyEdits status:500

Thanks,
Shweta
0 Kudos
8 Replies
by Anonymous User
Not applicable
I have seen this before when the proxy isn't able to pass the Post through.

Make sure you have the REST endpoint of your Feature Service Server listed in the proxy file as a valid destination.  I don't have any experience with the jsp proxy, but in the php version, you just add the server to the list.  If your endpoint is:

http://server.domain.com/ArcGIS/rest/services/MyFolder/MyService/FeatureServer

Then you would add an entry in the proxy file for:

http://server.domain.com/ArcGIS/rest/

In your case, you would add an entry for:  http://server:8399/arcgis/rest/

And you should see it start to work.  If not, there might be a problem in the application code or on the server side.  Look at the permissions between the Feature Service and the data store, and that all of the attributes match between your feature service and the feature you are trying to add.

Jeff
0 Kudos
shwetakunjadia
New Contributor
Thanks Jeff for replying...

i have checked everything but still it not working 😞

Same error message is coming...

Regards,
Shweta
0 Kudos
shwetakunjadia
New Contributor
Hello Alll,

Can anyone tell me is therr anything wrong in proxy.jsp file??

Code:

<%@page session="false"%>
<%@page import="java.net.*,java.io.*" %>
<%!
String[] serverUrls = {
  "http://server:8399/arcgis/rest/services/"
};
%>
<%
try {
  String reqUrl = request.getQueryString();
  boolean allowed = false;
  String token = null;
for(String surl : serverUrls)
 
{
    String[] stokens = surl.split("\\s*,\\s*");
    if(reqUrl.toLowerCase().contains(stokens[0].toLowerCase())) {
      allowed = true;
      if(stokens.length >= 2 && stokens[1].length() > 0)
        token = stokens[1];
      break;
    }
  }
  if(!allowed) {
    response.setStatus(403);
    return;
  }
  if(token != null) {
    reqUrl = reqUrl + (reqUrl.indexOf("?") > -1 ? "&" : "?") + "token=" + token;
  }
  URL url = new URL(request.getQueryString());
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setDoOutput(true);
con.setRequestMethod(request.getMethod());
int clength = request.getContentLength();
if(clength > 0) {
  con.setDoInput(true);
  InputStream istream = request.getInputStream();
  OutputStream os = con.getOutputStream();
  final int length = 5000;
   byte[] bytes = new byte[length];
   int bytesRead = 0;
   while ((bytesRead = istream.read(bytes, 0, length)) > 0) {
     os.write(bytes, 0, bytesRead);
   }
}
out.clear();
  out = pageContext.pushBody();
OutputStream ostream = response.getOutputStream();
response.setContentType(con.getContentType());
InputStream in = con.getInputStream();
final int length = 5000;
  byte[] bytes = new byte[length];
  int bytesRead = 0;
  while ((bytesRead = in.read(bytes, 0, length)) > 0) {
    ostream.write(bytes, 0, bytesRead);
  }
} catch(Exception e) {
response.setStatus(500);
}
%>

Please help me i want it to be working as soon as possible 😞

Thanks,
Shweta
0 Kudos
shwetakunjadia
New Contributor
Finally Done..........

Thanks to All .......


Shweta
0 Kudos
by Anonymous User
Not applicable
Great news!

Thanks for posting that it's resolved.  What was the solution?

JA
0 Kudos
PreranaDoshi
New Contributor
I am also interested in solution. Kindly share.
0 Kudos
DavidHollema
New Contributor III
I had the same error with an .ashx proxy page -> http://forums.arcgis.com/threads/40466-Editing-map-using-Proxy
0 Kudos
ClaudioSantos1
New Contributor
Hi all,

I was stuck on this issue, then i found a solution for my problem.

I put the configuration of my proxy at the top of proxy.jsp after "try{" then works.

 System.setProperty("http.proxyHost", "<proxy_ip>");
 System.setProperty("http.proxyPort", "<proxy_port>");


[]'s
0 Kudos