Printing using secured Services

3703
1
Jump to solution
06-03-2015 01:50 AM
NigelDsouza
Occasional Contributor

HI,

I have two Map services which are secured using a http referrer token. I have published a print tool as per the help tutorial at

ArcGIS Help 10.1 yet my print tool does not seem to work. The server log displays an error like

Layer "<Test>": Unable to connect to map server at http://<server>/arcgis/rest/services/<servcename>/MapServer. Failed to execute (ExportWebMap). Failed to execute (Export Web Map).

However if I alter the services from "private" to "public" i.e remove the token then the tool prints out the map.

Note: I have to achieve this using a token generated by the http referrer option only.

Can anyone provide me a solution or a workaround to the same?

Regards,

Nigel.

0 Kudos
1 Solution

Accepted Solutions
NigelDsouza
Occasional Contributor

Got a solution .

This case is if you need to use long lived tokens like I do.

1. Publish your custom print gp service tool as directed though the following link ArcGIS Help 10.1 .

2. The using the PrintParamters class in the API generate a JSON object of the print Parameters using the "toJSON" method on the class. This will return the layout format, template and Web_Map_JSON.

3. Loop through the web_map_json.oprationalLayers array and remove the "web_map_json.oprationalLayers.token" property from all the layers that have them.

4. Then use the GeoProcessor class to execute the print parameters by passing in the object returned from the .toJSON method on the printParameters class.

5. And your should get a print out.

View solution in original post

0 Kudos
1 Reply
NigelDsouza
Occasional Contributor

Got a solution .

This case is if you need to use long lived tokens like I do.

1. Publish your custom print gp service tool as directed though the following link ArcGIS Help 10.1 .

2. The using the PrintParamters class in the API generate a JSON object of the print Parameters using the "toJSON" method on the class. This will return the layout format, template and Web_Map_JSON.

3. Loop through the web_map_json.oprationalLayers array and remove the "web_map_json.oprationalLayers.token" property from all the layers that have them.

4. Then use the GeoProcessor class to execute the print parameters by passing in the object returned from the .toJSON method on the printParameters class.

5. And your should get a print out.

0 Kudos