210 likes | 348 Views
ArcIMS Emulation with IMSEMU. A Short Introduction to ArcXML and Reverse Engineering. Paul Ramsey Refractions Research. What Map Servers Do. “Tell me what you have!?!” “I have some layers.” “Give me a map of this place!! Use these layers!” “OK, here’s a map.”. Map Server Languages.
E N D
ArcIMS Emulationwith IMSEMU A Short Introduction to ArcXML and Reverse Engineering Paul RamseyRefractions Research
What Map Servers Do • “Tell me what you have!?!” • “I have some layers.” • “Give me a map of this place!! Use these layers!” • “OK, here’s a map.”
Map Server Languages • OpenGIS Web Map Server (URL GET) • GETCAPABILITIES • GETMAP • GETFEATUREINFO • ESRI ArcXML (XML POST) • <GET_SERVICE_INFO> • <GET_IMAGE> • <GET_FEATURES>
ArcXML Mapserver IMSEMU ESRI ClientArcMap ArcExplorerWeb Page ArcIMS Emulation • Goal: Speak ArcXML Like a Native MapScript
EMU IMSEMU • Perl CGI • Mapscript • com.esri.esrimap.Esrimap • Requires: HTTP Server, Perl with, XML::Parser XML::Writer Perl Mapscript
ArcIMS One Server, Multiple Services Projection ID WKT Projection Mapserver One Server, Multiple Map Files EPSG Number Proj4 Projection ArcIMS Mapserver
IMSEMU Installation • Copy com.esri.esrimap.Esrimap to CGI directory • Edit httpd.conf to alias “servlets” ScriptAlias /servlet/ "/home/www/mapserv/cgi-bin/" • Edit head of script to point to valid map files my @files = (“92K,26910,/home/www/mapserv/maps/92k.map”,“PGIS,42102,/home/www/mapserv/maps/pgsql.map”);
IMSEMU Operation • Responds to ArcIMS-style requests http://mapserver.refractions.net /servlet/com.esri.esrimap.Esrimap ?ServiceName=catalog &CustomStream=False
POST /servlet/com.esri.esrimap.Esrimap ?ServiceName=BCView &CustomStream=False HTTP/1.1Content-Length: 120User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)Host: mapserver.refractions.netConnection: Keep-AliveCache-Control: no-cache<?xml version="1.0" encoding="UTF-8"?><ARCXML version="1.0.1"><REQUEST dpi="96"><GET_SERVICE_INFO/></REQUEST></ARCXML>
encoding="UTF-8"Causes ArcMap to CRASH HTTP/1.1 200 OKServer: Microsoft-IIS/5.0Date: Wed, 24 Oct 2001 17: 08:42 GMTContent-Type: text/plainConnection: Keep-Alive<?xml version="1.0" ?><ARCXML version="1.1"><RESPONSE><SERVICES><SERVICE NAME="ActiveMODIS Fires" SERVICEGROUP="FeatureServer1" ACCESS="PUBLIC" TYPE="FeatureServer" DESC="" group="*" STATUS="ENABLED"><ENVIRONMENT><LOCALE country="US" language="en" /><UIFONT name="Arial" /></ENVIRONMENT></SERVICE></SERVICES></RESPONSE></ARCXML>
Sniffer HTTPLookngrep Learning the Lingo • Read the ArcXML Reference • google arcxml reference • Sniff the Wire ArcXML ESRI ClientArcMap ArcExplorerWeb Page ArcIMS
ngrep ngrep -d eth0 host 192.168.50.71 and tcp port 80 T 128.128.40.68:80 -> 192.168.50.71:2044 [AP] HTTP/1.1 200 ..Date: Tue, 01 Jun 2004 04:12:07 GMT..Server: Apache/2.0.42 ( Win32) mod_jk/1.2.4..Content-Language: en..Keep-Alive: timeout=15, max=99.. Connection: Keep-Alive..Transfer-Encoding: chunked..Content-Type: text/plai n; charset=ISO-8859-1....160.....d....<?xml version="1.0" encoding="UTF-8"? >..<ARCXML version="1.1">..<RESPONSE>..<IMAGE>..<ENVELOPE minx="-86.5816123 189285" miny="30.3584262004056" maxx="-86.4186258678133" maxy="30.482580309 1411" />.....d....<OUTPUT url="http://coastalmap.marine.usgs.gov/output/GoM ex_shoreline_change_KAI24668574026.jpg" />..</IMAGE>..</RESPONSE>..</ARCXML >.....f..
perl use LWP::UserAgent; $url = "http://198.102.62.145/servlet/com.esri.esrimap.Esrimap?ServiceName=ESRI_World&CustomStream=True&ClientLocale=en_US&ClientVersion=3.1"; my $ua = new LWP::UserAgent; my $req = HTTP::Request->new(POST => $url); $req->content(qq{<?xml version="1.0" encoding="UTF-8"?><ARCXML version="1.1"><REQUEST><GET_IMAGE><PROPERTIES><ENVELOPE minx="-209.08653257226464" miny="-143.95447414784505" maxx="187.68158936045373" maxy="158.28164557942696" /><IMAGESIZE width="596" height="454" dpi="96" /><LAYERLIST order="true"><LAYERDEF id="V1 Coverage 3" visible="true” /></LAYERLIST></PROPERTIES></GET_IMAGE></REQUEST></ARCXML>}); my $res = $ua->request($req); if ($res->is_success) { print $res->content; } dÅ<?xml version="1.0" encoding="UTF-8"?> <ARCXML version="1.1"> <RESPONSE> <IMAGE> <ENVELOPE minx="-209.086532572264" miny="-143.954474147845" maxx="187.681589360453" maxy="158.281645579426" /> dÓ<OUTPUT file="/net/dbserver/work/common/geonet/maps/ESRI_World_bluemap11910313481.gif" url="http://redlands.geographynetwork.com/out/maps/ESRI_World_bluemap11910313481.gif" /> </IMAGE> </RESPONSE> </ARCXML> f
100 197 207 100 102 hexedit 00 00 00 64 00 00 00 C5 3C 3F 78 6D 6C 20 76 65 72 73 69 6F ...d....<?xml versio 6E 3D 22 31 2E 30 22 20 65 6E 63 6F 64 69 6E 67 3D 22 55 54 n="1.0" encoding="UT 46 2D 38 22 3F 3E 0D 0A 3C 41 52 43 58 4D 4C 20 76 65 72 73 F-8"?>..<ARCXML vers 69 6F 6E 3D 22 31 2E 31 22 3E 0D 0A 3C 52 45 53 50 4F 4E 53 ion="1.1">..<RESPONS 45 3E 0D 0A 3C 49 4D 41 47 45 3E 0D 0A 3C 45 4E 56 45 4C 4F E>..<IMAGE>..<ENVELO 50 45 20 6D 69 6E 78 3D 22 2D 32 30 39 2E 30 38 36 35 33 32 PE minx="-209.086532 35 37 32 32 36 34 22 20 6D 69 6E 79 3D 22 2D 31 34 33 2E 39 572264" miny="-143.9 35 34 34 37 34 31 34 37 38 34 35 22 20 6D 61 78 78 3D 22 31 54474147845" maxx="1 38 37 2E 36 38 31 35 38 39 33 36 30 34 35 33 22 20 6D 61 78 87.681589360453" max 79 3D 22 31 35 38 2E 32 38 31 36 34 35 35 37 39 34 32 36 22 y="158.281645579426" 20 2F 3E 0D 0A00 00 00 64 00 00 00 CF 3C 4F 55 54 50 55 54 />.....d....<OUTPUT 20 66 69 6C 65 3D 22 2F 6E 65 74 2F 64 62 73 65 72 76 65 72 file="/net/dbserver 2F 77 6F 72 6B 2F 63 6F 6D 6D 6F 6E 2F 67 65 6F 6E 65 74 2F /work/common/geonet/ 6D 61 70 73 2F 45 53 52 49 5F 57 6F 72 6C 64 5F 72 65 64 6D maps/ESRI_World_redm 61 70 35 33 37 30 33 31 33 34 33 33 2E 67 69 66 22 20 75 72 ap5370313433.gif" ur 6C 3D 22 68 74 74 70 3A 2F 2F 72 65 64 6C 61 6E 64 73 2E 67 l="http://redlands.g 65 6F 67 72 61 70 68 79 6E 65 74 77 6F 72 6B 2E 63 6F 6D 2F eographynetwork.com/ 6F 75 74 2F 6D 61 70 73 2F 45 53 52 49 5F 57 6F 72 6C 64 5F out/maps/ESRI_World_ 72 65 64 6D 61 70 35 33 37 30 33 31 33 34 33 33 2E 67 69 66 redmap5370313433.gif 22 20 2F 3E 0D 0A 3C 2F 49 4D 41 47 45 3E 0D 0A 3C 2F 52 45 " />..</IMAGE>..</RE 53 50 4F 4E 53 45 3E 0D 0A 3C 2F 41 52 43 58 4D 4C 3E 0D 0A SPONSE>..</ARCXML>.. 00 00 00 66...f
ArcIMS Modes • ServiceName=catalog • CustomStream=True|False • Encode=True|False • Form=True|False • ClientLocale=en_US • ClientVersion=3.1
IMSEMU Capabilities • Image Serving • GET_CLIENT_SERVICES • GET_SERVICE_INFO • GET_IMAGE • FILTER_COORDSYS (Coordinate Reprojection) • CustomStream=True|False • Encode=True|False
IMSEMU To Do • Feature Serving • GET_FEATURE(default, xml, xmlnew) • SPATIALQUERY / QUERYFILTER • Image Serving with Selections and Acetates • Inline LAYER objects.