Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Remote ArcIMS server in a frameless html viewer

There have been some questions about how to run Frameless Html Viewer in a separate web Server and access a Remote Arcims Server from it. Javascript has the same origin policy which prevents a webpage loaded from one server communicating to a different server for security reason. To work around this problem in the HTML Viewer, there is a property in the Servlet Connector called redirect which allows forwarding the ArcXML requests to the remote ArcIMS server. Thus by installing the Servlet Connector on a web server and setting it to redirect to any remote server, we can 'fool' the Javascript to think that it's loading the response from the same server.
I initially thought this would work for the frameless viewer too. On further testing, it appeared that the redirection in servlet connector works only with the form based requests.
There is still another work around though. This is to create a web application in jsp/ASP/Servlet etc and deploy it on the web server. The web application needs to simply forward the ArcXML requests to the remote ArcIMS Server and get back the responses. It is pretty simple to create such application using one of the connectors.
For instance, here is the JSP code to do this:

<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="com.esri.aims.mtier.io.ConnectionProxy" %>
<%
String server = "http://www.geographynetwork.com";
String service = "ESRI_World";
ConnectionProxy mcp = new ConnectionProxy();
mcp.setConnectionType(ConnectionProxy.HTTP);
mcp.setService(service);
mcp.setUrl(new java.net.URL(server));
int reqLength = request.getContentLength();
byte[] reqByte;
if (reqLength > 0) {
reqByte = new byte[reqLength];
int data = 1;
int offset = 0;
while (data > 0) {
data = request.getInputStream().read(reqByte, offset,reqLength - offset);
offset = offset+ data;
}
String axl = new String(reqByte);
String res = mcp.send(axl);
out.println(res);
} else
out.println("Error");
%>



This post first appeared on Geo Coding, please read the originial post: here

Share the post

Remote ArcIMS server in a frameless html viewer

×

Subscribe to Geo Coding

Get updates delivered right to your inbox!

Thank you for your subscription

×