Select to view content in your preferred language

token based security and 10.1 printing gp service

9192
25
09-21-2012 07:13 AM
Drew
by
Frequent Contributor
Has anyone successfully produced a print when using a secured service?

I am getting the following error..

Error executing tool.: Layer "ArcGISDynamicMapServiceLayer405": Unable to connect to map server at    [...Web map URL with token written here......] Failed to execute (ExportWebMap). Failed to execute (Export Web Map)




Is there something I need to configure?

Drew
Tags (2)
25 Replies
Drew
by
Frequent Contributor
* BUMP *

I am trying to use the print task and am getting the quoted error when using a secured service.
Has anyone successfully printed a secured service?

Drew

Has anyone successfully produced a print when using a secured service?

I am getting the following error..

Error executing tool.: Layer "ArcGISDynamicMapServiceLayer405": Unable to connect to map server at    [...Web map URL with token written here......] Failed to execute (ExportWebMap). Failed to execute (Export Web Map)




Is there something I need to configure?

Drew
0 Kudos
DasaPaddock
Esri Regular Contributor
How is the token being generated? Is it restricted by referer or ip address?
0 Kudos
Drew
by
Frequent Contributor
How is the token being generated? Is it restricted by referer or ip address?


It is restricted by HTTP Referer.
0 Kudos
DasaPaddock
Esri Regular Contributor
When the print service makes its request to the url with the token, it doesn't send a referer header. Can you use a short term token that's not restricted to ip or referer?

That's how the tokens are generated by the IdentityManager.

If this is not an option for you, you could call PrintParameters.toJSON() and then remove the token from the url in the JSON. You'd then need to use a Geoprocessor to call your print service with the modified JSON. You'd also need to follow these instructions to set up your print service with the credentials for the secure service.
http://resources.arcgis.com/en/help/main/10.1/#/Printing_maps_that_contain_secured_services/01540000...
0 Kudos
NigelDsouza
Frequent Contributor

This helped thanks .

0 Kudos
weeyeo
by
Emerging Contributor
Can you show me how do you write a code to perform this task? I had created a new secured print service for my gp service. Thank you.
0 Kudos
Drew
by
Frequent Contributor
Can you show me how do you write a code to perform this task? I had created a new secured print service for my gp service. Thank you.


wyoe -> It's funny your asking this because I am finally just returning to the issue. I tried a few months back but I dropped it because bigger things fell onto my plate.

Just yesterday I came back and started work on it again (due to a urgent need)

Anyways.. its not the most simple process.  I am finding It only works when the service references port 6080 and not port 80 and the service has no token..

So my plan is ..... (not yet implemented)

- convert PrintParameters to JSON
- find and replace all ?token= ABC
- find and replace domain.com with domain:6080.com
- send via HTTP and POST using the REST API because there is no PrintParamaters.fromJSON yet 🙂

This is my plan,  it might change if i find issues.

Drew
0 Kudos
MayJeff
Deactivated User
Thanks for replying my thread.  At least I am not the only one having this problem now. Would you please keep me update if you able to get it to works.  I really appreciated that.  Do you think have to do anything on the proxy file too?  I run all my secured map services on 10.1 and everything is working find except the printTask.   I also run a esri high-quality printing simple code (https://developers.arcgis.com/en/flex/sample-code/printtask.htm) then change url & secure gp sevices to my own services and get the same message. Really spending alot of time on it and didn't find any documents or ways from ESRI team.  Just wonder is it a PrintTask bug on 10.1 or not many people using this function at all?
0 Kudos
weeyeo
by
Emerging Contributor
Thanks for replying my thread.  At least I am not the only one having this problem now. Would you please keep me update if you able to get it to works.  I really appreciated that.  Do you think have to do anything on the proxy file too?  I run all my secured map services on 10.1 and everything is working find except the printTask.   I also run a esri high-quality printing simple code (https://developers.arcgis.com/en/flex/sample-code/printtask.htm) then change url & secure gp sevices to my own services and get the same message. Really spending alot of time on it and didn't find any documents or ways from ESRI team.  Just wonder is it a PrintTask bug on 10.1 or not many people using this function at all?
0 Kudos