PrintTask, Secure AGS Service, and Resource Proxy

8929
10
02-25-2016 08:48 AM
deleted-user-RAnWn8DDSd1P
New Contributor III

I use the .NET proxy to run transparent token auth for a secure service. URLs to the secure service in the Web_Map_as_JSON cause the PrintTask execute to fail 400, citing the secure service URLs.  I've tried proxying the execute call to fetch a token and changing the URLs in the Web_Map_as_JSON to go through the proxy but no dice.  I've seen this article referenced in response about this problem, but we have short lived tokens and the way this article reads we shouldn't need a custom print service. Is it possible to use PrintTask with a webmap definition referencing secure services by somehow using the resource proxy or do we need to go this route with the custom print service? 

10 Replies
ZianChoy
Occasional Contributor

Could you post a diagram of how the PrintTask is supposed to talk to the secure service? That would help me understand your question better.

I'm doing almost the same thing as you so I'm curious to see what problem(s) you encountered.

0 Kudos
CaseyVandenberg1
New Contributor

We had a similar situation. We have a .net application that was trying to use a print service that included the credentials for a secured WMS provided by an external source. Whenever we tried to use the print service, we received the 400 error. The only thing we needed to do at the end of the day to get it to work was to log into our ArcGIS for server machine using the ArcGIS Server account credentials and connect to the internet. ESRI suggested that when you log-in as the ArcGIS Server account for the first time, proxy settings are populated to it and the ArcGIS for Server can then access internet to connect to the external WMS service.

0 Kudos
deleted-user-RAnWn8DDSd1P
New Contributor III

Ok so my JavaScript application loads webmaps, some of which have operational layers that are to services that are not public. We use the .NET resource proxy script to do token auth against our ArcGIS server for those URLs so users won't have to login. This works.  When, from the JavaScript API, I call a PrintTask it fails when one of these definitions contains URLs that are to protected services. From what I can gather the ArcGIS Server print service is making its own requests after getting the Web_Map_as_JSON definition. So even if I manipulate these URLs to go through the proxy script I can't get a PrintTask to successfully execute from the client

0 Kudos
ArtemisFili
Esri Contributor

The resource proxy will not print a secured map service. This is by design. So it is possible to use the proxy in order to authenticate and display the secured service on the map, but when it comes to printing a secured service, the resource proxy will not handle this scenario as it will not pass the token in the Web_Map_as_JSON parameter. If you are using a short lived token, then a solution would be to let the identity manager handle the authentication for you, meaning that you will get a prompt to enter your credentials once the app loads and then these credentials will be used when you try to print. Otherwise, you can create a custom print service and embed the credentials as described in the article. If you choose to use the second option, please make sure that you use a 10.3 print service or above as there was an issue in the earlier versions which is fixed in 10.3

ChristopherSchreiber
Occasional Contributor II

Artemis,

What if you are trying to generate a print that includes secured feature services that are hosted on ArcGIS Online?

We have created an app that is embedded in a website. In order to bypass the need to log in to ArcGIS Online whenever the app is opened, we have utilized the proxy.

We would like to include Esri's print functionality into the app. But with the proxy utilized, the print requests fail as the Esri Print Service does not have permissions to access the layers.

Thanks!

Chris

0 Kudos
AshleyRymer1
New Contributor

Hi Chris,

I am having exactly the same problem as yourself. 

I was wondering if you managed to come up with a solution for this? I haven't got access to ArcGIS Server so Im looking for a solution that negates the need to create a custom print services.

Any help would be appreciated.

Thanks

Ash

0 Kudos
JanineLatham
New Contributor II

Has anyone found a workaround for this? The thread does not indicate so. Please let me know we have services that are not able to print the services on a map that we have loaded in our API that are was from NOAA or that are secured livefeeds through esri. 

0 Kudos
ChristopherSchreiber
Occasional Contributor II

Janine, 

For Esri love feeds, you could use a proxy hosted on ArcGIS Online. We use the weather watches, warnings, and advisories layer and have it pass through a hosted proxy so that it can be printed. 

Please be aware that if the Esri service consumes credits, then a hosted proxy may not be the best solution, as your account would be billed the credits.

For more info on hosted proxies, and how to set one up, see the link: Working with Proxy Services | ArcGIS for Developers 

Chris

0 Kudos
FlavieMORAUX1
Occasional Contributor

Hello AFili-esristaff‌,

Proxy limitation on printing is still present?
Thanks,

Flavie

0 Kudos