Install the JavaScript API for use with ArcGIS 10.2 for Server

Summary

When using ArcGIS for Server in an isolated or secure environment, it may not be possible to access the hosted Esri JavaScript API libraries. This article provides a walkthrough for installing a local copy of the JavaScript API and configuring it for use with ArcGIS 10.2 for Server.

Procedure

 This document assumes that Microsoft IIS is being used as the web server. If using a different program, some steps may not apply or may be different based on that configuration. Please consult that software’s documentation if needed.

Download and install the JavaScript API

1. Navigate to the ArcGIS API for JavaScript page.

2. Under the Download section, click the link to the ArcGIS API for JavaScript section of the Esri Download page.

[O-Image]

3. Scroll down to the latest ArcGIS API for JavaScript API release (currently v3.8).

[O-Image]
4. Click the ‘arcgis_js_v38_api.zip’ link and log in with an Esri Global Account username and password.

[O-Image]

5. Accept the License Agreement to start the download. -show me-

[O-Image]

Modify JavaScript files

1. Unzip the contents of the .zip file to a temporarily location. -show me-

 This may take a few minutes. While not physically large, the .zip file contains approximately 17K files that must be extracted.

2. Copy the arcgis_js_api folder into the web server root folder, typically:

C:\inetpub\wwwroot
 Please note in the following two steps, do not include ‘http://’ with the fully qualified host name as this is already defined in the two files.

3. Open the following file in a text editor:

C:\Inetpub\wwwroot\arcgis_js_api\library\3.8\3.8\init.js

4. Search for the text ‘[HOSTNAME_AND_PATH_TO_JSAPI]’, and replace this text with:

<myhost.example.com>/arcgis_js_api/library/3.8/3.8/

5. Open the following file in a text editor:

C:\Inetpub\wwwroot\arcgis_js_api\library\3.8\3.8\js\dojo\dojo\dojo.js

6. Search for the text ‘[HOSTNAME_AND_PATH_TO_JSAPI]’, and replace this text with:

<myhost.example.com>/arcgis_js_api/library/3.8/3.8/

Add IIS default document

1. Open IIS and navigate to the Default Web Site.

2. Open the Default Document. -show me-

[O-Image]

3. Under the Actions heading, click Add. -show me-

[O-Image]

4. Type init.js as the name value, and click OK. -show me-

[O-Image]

Init.js should now be listed as a Local Entry Type default document. -show me-

[O-Image]

Edit ArcGIS services

1. In a web browser on the server navigate to the following location:

http://localhost:6080/arcgis/admin/system/handlers/rest/servicesdirectory

2. Login with administrator credentials. -show me-

[O-Image]

3. Copy or take a screenshot of the current Services Directory settings in case it is necessary to revert to the default settings.

4. Click ‘edit’ to modify settings. -show me-

[O-Image]

5. Replace each of the following fields with the path to the local installation of the JavaScript API using the fully qualified host name in place of the following examples:

• Javascript API URL:

http://myhost.example.com/arcgis_js_api/library/3.8/3.8/

• Javascript API CSS URL:

http://myhost.example.com/arcgis_js_api/library/3.8/3.8/js/dojo/dijit/themes/tundra/tundra.css

• Javascript API CSS2 URL:

http://myhost.example.com/arcgis_js_api/library/3.8/3.8/js/esri/css/esri.css

-show me-

[O-Image]
 If your server is configured to use HTTPS only, modify the examples above to use HTTPS instead of HTTP as the URL connection.

6. Clear the browser cache to complete installation.

 To confirm that ArcGIS for Server is using the correct settings for the JavaScript API, open a web debugging program and preview a map service using the ArcGIS JavaScript viewer from the Services Directory (REST). If configured correctly, the viewer should load successfully and all URLs listed in the web debugger are from the local web server and not from ‘serverapi.arcgisonline.com’
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s