Secured Printing Service

8674
17
Jump to solution
03-25-2015 08:04 PM
SaurabhGupta5
Occasional Contributor

Hello All,

I am using ArcGIS Server 10.2.2 default printing service gp service but it is not working for secured services. All the services are secured using ArcGIS Builtin security model and i am also using proxy page in between to talk to these services but when i am using printing gp service it is not working. what could be the issue. please help.

Thanks

0 Kudos
17 Replies
JimFaulkner
New Contributor III

Can you try generating the token using the server's IP address instead of it's server name / domain name? ie., http://192.168.1.1.egisqa/tokens/generateToken instead of: http://servername/egisqa/tokens/generateToken

Generally speaking, an error code of 498 indicates either an expired token (so, you might also need to look at the server's timeout settings for tokens) or an invalid token

0 Kudos
SaurabhGupta5
Occasional Contributor

Hi Jim,

I tried using ip to generate tokens but no success

0 Kudos
SaurabhGupta5
Occasional Contributor

Token settings are also good token.JPG

0 Kudos
SaurabhGupta5
Occasional Contributor

Also attached the form i m using for testing.

<html>
<head>
</head>
<body>
<form action="http://gisdevqa1/Proxy/proxy.ashx?http://gisdevqa1/egisqa/rest/services/ExportWebMap/GPServer" method="post">

  <input type="hidden" name="Format" value="PDF" />

  <input type="hidden" name="token" value="hE7QQ6SENW8cpXHnDTlgXpJsW-AoFRi9tPyxQvoz7JQCP1TVHYw_ylJdUFiWOM36" />

  <input type="hidden" name="f" value="pjson" />

  <input type="hidden" name="Web_Map_as_JSON" value="{'layoutOptions':{'authorText':'GERI','titleText':'sg','legendOptions':{'operationalLayers':[{'id':'Others'},{'id':'Clouds Over Time'},{'id':'GEOSPACE'},{'id':'Geometric Network (Network Trace)'},{'id':'CWD Notification System'},{'id':'Drainage Map (DIMS)'},{'id':'Water Quality & Contract Boundary'},{'id':'Planning Boundary'},{'id':'WRN Notification Map'},{'id':'Sewerage Map (SIMS)'},{'id':'Potable Water Supply Zones'},{'id':'Demand Zones'},
{' id':'BQ Segment'},{'id':'HDB Dwellings & Water Efficiency'}]},'copyrightText':'Copyright ©2015 Public Utilities Board (PUB). All rights reserved.'},'exportOptions':{'dpi':96},'mapOptions':{'extent':{'spatialReference':{'wkid':3414},'xmax':71930.5746856367,'ymin':23128.63091815375,'xmin':-18424.81435847472,'ymax':45750.55116199424}},'operationalLayers':[{'id':'Street View','maxScale':250,'title':'Street View','url':'http://gisdevqa1/egisqa/rest/services/GERI_Geospace/streetdirectorycache/MapServer','minScale':25000...},
{'id':'Water Property Critical','visibleLayers':[0],'maxScale':0,'title':'Water Property Critical','url':'http://gisdevqa1/egisqa/rest/services/GERI_WSN/wsnwaterpropertycritical/MapServer','minScale':0}]}" />

<input type="submit" value="Submit" />

</form>

</body>
</html>

0 Kudos
JimFaulkner
New Contributor III

You might need to put in a help ticket with ESRI then - I'm completely stumped

0 Kudos
SaurabhGupta5
Occasional Contributor

Thanks for all your help jim.

I will try initiating ESRI ticket for same.

Many Thanks!!

Regards

SaurabhGupta5
Occasional Contributor

Here i found the solution of this issue

look at the following page:

https://github.com/djarrard/WebmapWrappers#webmap-wrapper-project

It is provided as a workaround for such scenario. The
link provides a python file to download along with its project package.

What it does is modifying the webmap JSON prior to
executing a print task. It is what's needed in the your scenario (Insert token
with printing secured services when the application uses a proxy page).

However, just like Jim mentioned in post,
the username and password to ArcGIS Server are configured explicitly, but this
time configured within the python script.

Hope this will be helpfull for lot of developers working on version 10.2.2

Saurabh

BryanMc
Occasional Contributor

The customized python/github solution does work with both 10.2.2 and 10.3, but I thought I would add my two cents as I had the same issues too. Overall, the application and the Print Service should be thought of as completely separate items. The application can use the current Esri proxy for (short) tokens, or you can use a long token embed into application. Either will work.

As for the Print Service, neither will work from the application if map services are secured (although access to the print service can be done both ways). The Esri Proxy short token includes a referer. However, the Print Service will make a new map request itself (based on the JSON strings already shown), but the Print Service doesn't include a referer with its request to the map service (assuming it's also secure). The map service will reject the token since there is no referer even if included in JSON unless you specifically create the token without a referer (or user enters the user/pw at prompt).

You can use the help documentation for the "Long token approach" for the print service (embeds credentials in the Print service) while still using Esri proxy short tokens for map and print service connection. But the short token via Proxy doesn't work once the print service tries to create its own map - although I just heard from support that my enhancement request was accepted to make this more clear in the help

Here is an article that goes more in-depth on this (yes, full disclaimer I wrote it - but easier to refer to it than retype): http://www.spatialtimes.com/2015/04/printing-with-arcgis-for-server-10-3/

Hope it can help.