Print map with secured WMTS layer using Export Web Map task

2949
3
09-15-2015 12:50 AM
VishApte
Esri Contributor

Hi,

I am trying to print a map that contains secured WMTS layer as basemap and some operational layers. I have read article Printing maps that contain secured services—Documentation (10.3 and 10.3.1) | ArcGIS for Server

However, the above article seems to pertain to printing secured ArcGIS server service. The basemap service I am trying to print is a non-esri secured WMTS service with basic authentication (401 challenge in browser) I am not sure username and password I stored in the Export Web Map Task in a custom toolbox will work for WMTS. I get error below trying to send map JSON.

Executing: ExportWebMap " {"mapOptions":{"showAttribution":true,"extent":{"xmin":16055389.637985548,"ymin":-4594960.104620628,"xmax":16192976.288898917,"ymax":-4503235.670678381,"spatialReference":{"wkid":102100}},"spatialReference":{"wkid":102100},"scale":577790.5542889956}, "operationalLayers":[{"id":"layer0","title":"layer0","opacity":1,"minScale":591658710.9091313,"maxScale":564.2497164995802,"url":"https://somewmtsserver.com/WMTS","type":"wmts","layer":"cfm","style":"default","format":"image/png","tileMatrixSet":"XYZCompatible"},{"id":"mapDiv_graphics","opacity":1,"minScale":0,"maxScale":0,"featureCollection":{"layers":[]}}], "exportOptions":{"outputSize":[800,1100],"dpi":96}}" C:\Users\myname\Documents\ArcGIS\1bbb03a94e3a45e284f49fd83c94ebae.png PNG8 # MAP_ONLY

Start Time: Tue Sep 15 17:23:22 2015

Layer "layer0": Failed to create layer from service at https://somewmtsserver.com/WMTS .

Client tried to access password-protected page without proper authorization.

Failed to execute (ExportWebMap).

Failed at Tue Sep 15 17:23:22 2015 (Elapsed Time: 0.36 seconds)

Has anyone managed to print secured WMTS layer using Export Web Map task? If so, what technique was used?

Thanks,

Vish

0 Kudos
3 Replies
TanuHoque
Esri Regular Contributor

Vish,

Storing credentials with the ExportWebMap Tool should work with non-Esri secured WMTS service too.

Could you pls try this in Desktop and have Fiddler (or some other tool) to check what is going on?

If that does not help much, I'd suggest you to contact Esri Support and open an incident for further investigation.

VishApte
Esri Contributor

Thanks Tanu for your reply.

I did check using Fiddler and found ArcMap Export Web Map custom task made two identical requests to WMTS service's get capabilities. I expected second request to include "Authorization: Basic xxxxxxx" in header but found it missing. Both calls hade below request

GET https://wmtsserver/WMTS/1.1.2?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities HTTP/1.1

Accept: */*

User-Agent: ArcGIS Client Using WinInet

Host: wmtsserver

Connection: Keep-Alive

Cache-Control: no-cache

I did the same WMTS get capabilities request using browser (IE) and found two requests in fiddler. First one did not have authorization header but second one did after I provided username and password. See second request below.

GET https://wmtsserver/WMTS/1.1.2/?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities HTTP/1.1

Accept: text/html, application/xhtml+xml, */*

Accept-Language: en-AU

User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)

Accept-Encoding: gzip, deflate

Host: wmtsserver

Authorization: Basic xxxxxxxxxxxxxxxxxxxx

Connection: Keep-Alive

DNT: 1

So my guess is ArcMap tool is not able to understand 401 challenge to inject basic authorization header in subsequent call even though the tool has the url registered with username and password.

Regards,

Vish

0 Kudos
TanuHoque
Esri Regular Contributor

Thanks Vish.

Which version of ArcGIS Server you are using? Will I be able to access that service to repro that in house? I have a feeling that it got fixed recently...

0 Kudos