Select to view content in your preferred language

Editing map using Proxy

6941
20
09-27-2011 08:10 PM
shwetakunjadia
Emerging Contributor
Hi All,

I am using arcgis server 10..
Javascript api 2.5
Editing map sample
I followed all steps to create Proxy on arcgis server..
I am not able to add any feature on map 😞


Error on fire  bug:

Error: Unable to load http://arcgis:8399/proxy/proxy.jsp?http://arcgis:8399/arcgis/rest/services/app1/FeatureServer/18/app... status:0
()?v=2.5 (line 14)
undefined = "[object Object]"
()?v=2.5 (line 14)
()?v=2.5 (line 14)
undefined = "-2"
(function(){var _1=null;if((_1||(typeo...etTimeout(dojo._loadInit,100);}})();

Please help me where i am going wrong ???
0 Kudos
20 Replies
shwetakunjadia
Emerging Contributor
Can anyone tell me where to set proxy.jsp ??
on server or on local machine??

Please someone help me.....

Thanks,
Shweta
0 Kudos
derekswingley1
Deactivated User
Your proxy has to live on the same server as your JS API app.

Are you able to contact support for help? This is something that they should be able to walk you through.
0 Kudos
shwetakunjadia
Emerging Contributor
yes both are on the same server still not getting 😞

Thanks,
Shweta
0 Kudos
derekswingley1
Deactivated User
Please contact support if you're unable to get it working by following the steps outlined here:  http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/ags_proxy.htm
0 Kudos
shwetakunjadia
Emerging Contributor
Is it Free to contact support team ???
0 Kudos
derekswingley1
Deactivated User
Unfortunately, no.
0 Kudos
shwetakunjadia
Emerging Contributor
😞

Is it necessary to set proxy page while i m edit/add feature on layer ??

Is there any other way in java script api ???

Thanks,
Shweta
0 Kudos
nicogis
MVP Alum
- have you tried insert feature from rest page?
- have you configurated serverUrls in page proxy?
- can you do debug on page.jsp calling page  http://arcgis:8399/proxy/proxy.jsp?h.../18/applyEdits ?
0 Kudos
shwetakunjadia
Emerging 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