<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Printing secured services... in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3734#M327</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for reply @&lt;A _jive_internal="true" class="" data-userid="5339" data-username="mcin8130" href="https://community.esri.com/people/mcin8130"&gt;Bryan McIntosh&lt;/A&gt;. I tried to change the recycle interval but not a success.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Aug 2019 10:32:24 GMT</pubDate>
    <dc:creator>SaiPeketi</dc:creator>
    <dc:date>2019-08-06T10:32:24Z</dc:date>
    <item>
      <title>Printing secured services...</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3729#M322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Hi,&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;ArcGIS Server Version:&amp;nbsp;10.7 (ArcGIS Online)&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;ArcGIS JS API: 3.29&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;In my web application, I am consuming secured services properly loading the map and have a requirement to print the map contents.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Initially, the token expiry was set to default (i.e. 60 mins) and everything worked fine including printing, using the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM style="border: 0px; font-weight: inherit;"&gt;Utilities/PrintingTools&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;GP Service.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;As part of the requirement, the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="border: 0px; font-weight: inherit; text-decoration: underline;"&gt;token expiry was increased from 60 mins to 240 mins&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;- everything still worked fine except for printing! Looking up the Esri help it was clear I had to create a custom service. I created the custom service as described in the help documents, but it still fails with the following error:&lt;/P&gt;&lt;DIV class="" style="background-color: #ffffff; border: 0px;"&gt;&lt;DIV class="" dir="ltr" lang="en-us" style="border: 0px; font-weight: inherit; margin: 1em 0px 3em;"&gt;&lt;DIV align="left" class="" dir="ltr" lang="en-us" style="border: 0px; font-weight: inherit;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit;"&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro" style="background: #f6f6f6; border-width: 0px 0px 0px 2px; border-style: initial initial initial solid; border-color: initial initial initial #cccccc; font-weight: inherit; margin: 10px 0px; padding: 10px 20px;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;Error executing tool. Export Web Map Task Job ID: jb88972125ace4b6593c8055ee779e920 : Layer "xxxx": Unable to connect to map server at&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fserver.domain%3A6443%2Farcgis%2Frest%2Fservices%2FWebViewer%2FMapServer%2F" rel="nofollow" style="color: #287433; border: 0px; font-weight: inherit; text-decoration: none; padding: 0px calc(12px + 0.35ex) 0px 0px;" target="_blank"&gt;https://xxxxx/arcgis/rest/services/xxxx/MapServer/&lt;/A&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;. Failed to execute (Export Web Map). Failed to execute (Export Web Map Task).&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P&gt;Any suggestion this issue occurs with particular layers on ArcGIS Online? If those layers are turned off then print tool works properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Regards&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Sai Anand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2019 16:42:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3729#M322</guid>
      <dc:creator>SaiPeketi</dc:creator>
      <dc:date>2019-08-02T16:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Printing secured services...</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3730#M323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sai. So just to be clear, the layer in question is hosted in ArcGIS Online? And the custom print service is hosted in ArcGIS Server? And where did you increase the token expiration date? In ArcGIS Server or ArcGIS Online?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, can you verify that the token is being passed to the print service? If so, is there any other information as part of the error message about the token? Does clearing the cache change any behavior?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2019 19:30:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3730#M323</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2019-08-02T19:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Printing secured services...</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3731#M324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/371720"&gt;SaiAnand Peketi&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;I've used this workaround since 10.3 and still using it with&amp;nbsp;10.7 (hopefully the same issue):&lt;/P&gt;&lt;P&gt;Set the token expiry time&amp;nbsp;and the custom print service recycle time to&amp;nbsp;the same value. So if you need short token expiry to be 240, change the print service recycle to 240 as well.&lt;/P&gt;&lt;P&gt;Hopefully this is the issue and it can help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Aug 2019 02:16:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3731#M324</guid>
      <dc:creator>BryanMc</dc:creator>
      <dc:date>2019-08-03T02:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Printing secured services...</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3732#M325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" href="https://community.esri.com/people/NSager-esristaff"&gt;Noah Sager&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Yes, Layers are hosted in ArcGIS Online. Yes,&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;custom print service is hosted in ArcGIS Server. Increase the token&amp;nbsp;&lt;SPAN&gt;expiration time on ArcGIS Online. My custom print service is not secured. And Shred the Print Service rest endpoint on the ArcGIS Online Content. But, still causing an issue. This behavior is only for a few layers. I tried permutation and combination with layers and check the difference between one was working perfectly fine with my custom print service but some layers are throwing this error.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN style="background-color: #f6f6f6; border: 0px; font-weight: inherit; font-size: 14px;"&gt;Error executing tool. Export Web Map Task Job ID: jb88972125ace4b6593c8055ee779e920 : Layer "xxxx": Unable to connect to map server at&lt;SPAN style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fserver.domain%3A6443%2Farcgis%2Frest%2Fservices%2FWebViewer%2FMapServer%2F" rel="nofollow" style="color: #287433; background-color: #f6f6f6; border: 0px; font-weight: inherit; text-decoration: none; font-size: 14px; padding: 0px calc(12px + 0.35ex) 0px 0px;" target="_blank"&gt;https://xxxxx/arcgis/rest/services/xxxx/MapServer/&lt;/A&gt;&lt;SPAN style="background-color: #f6f6f6; border: 0px; font-weight: inherit; font-size: 14px;"&gt;. Failed to execute (Export Web Map). Failed to execute (Export Web Map Task).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you let me know how to check the token is being passed correctly or not the web map JSON to print Service? Those ArcGIS online layers are working fine, I can perform query and popup task. But only get failed when trying with Print Service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sai Anand Peketi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Aug 2019 19:06:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3732#M325</guid>
      <dc:creator>SaiPeketi</dc:creator>
      <dc:date>2019-08-03T19:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: Printing secured services...</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3733#M326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used sample Print Widget template and set the proxy to login the ArcGIS online Feature service. That's one is loading properly on the map but failed Print Service.&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;var permitUrl = "https://services8.arcgis.com/xxxx/arcgis/rest/services/xxxx/FeatureServer/0";&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If I add the token manual then print service is working. Not sure why manual need to set the token for a print widget. Again this only for few layers, not all feature services.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;var permitUrl = "https://services8.arcgis.com/&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;xxxx&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;/arcgis/rest/services/&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;xxxx&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;/FeatureServer/0?token=xxxxxxxxxxxx";&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Snippet code of Print Widget. Let me know, did I make any mistake.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt; var app = {};&lt;BR /&gt; require([&lt;BR /&gt; "esri/map", "esri/layers/FeatureLayer",&lt;BR /&gt; "esri/dijit/Print", "esri/tasks/PrintTemplate", "esri/tasks/PrintTask",&lt;BR /&gt; "esri/request", "esri/config",&lt;BR /&gt; "dojo/_base/array", "dojo/dom", "dojo/parser", "esri/urlUtils",&lt;/P&gt;&lt;P&gt;"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"&lt;BR /&gt; ], function (&lt;BR /&gt; Map, FeatureLayer,&lt;BR /&gt; Print, PrintTemplate, PrintTask,&lt;BR /&gt; esriRequest, esriConfig,&lt;BR /&gt; arrayUtils, dom, parser, urlUtils&lt;BR /&gt; ) {&lt;BR /&gt; parser.parse();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;app.printUrl = "https://xxxx/arcgis/rest/services/xxx/GPServer/Export%20Web%20Map";&lt;BR /&gt; urlUtils.addProxyRule({&lt;BR /&gt; urlPrefix: "services8.arcgis.com/xxxx/arcgis/", //Server URL&lt;BR /&gt; proxyUrl: "proxy.ashx" // Path of Proxy page mine is avaiable on the root folder&lt;BR /&gt; });&lt;BR /&gt; esriConfig.defaults.io.proxyUrl = "proxy.ashx";&lt;/P&gt;&lt;P&gt;app.map = new esri.Map("map", {&lt;BR /&gt; basemap: "hybrid",&lt;BR /&gt; center: [-85.797466, 38.120622],&lt;BR /&gt; zoom: 17,&lt;BR /&gt; slider: false&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;// add graphics for pools with permits&lt;BR /&gt; var permitUrl = "https://services8.arcgis.com/xxxx/arcgis/rest/services/xxxx/FeatureServer/0";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;//var permitUrl = "https://services8.arcgis.com/&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;xxxx&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;/arcgis/rest/services/&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;xxxx&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;/FeatureServer/0?token=xxxxxxxxxxxx";&lt;/SPAN&gt;&lt;BR /&gt; var poolFeatureLayer = new FeatureLayer(permitUrl);&lt;BR /&gt; app.map.addLayer(poolFeatureLayer);&lt;/P&gt;&lt;P&gt;// get print templates from the export web map task&lt;BR /&gt; var printInfo = esriRequest({&lt;BR /&gt; "url": app.printUrl,&lt;BR /&gt; "content": { "f": "json" }&lt;BR /&gt; });&lt;BR /&gt; printInfo.then(handlePrintInfo, handleError);&lt;/P&gt;&lt;P&gt;function handlePrintInfo(resp) {&lt;BR /&gt; var layoutTemplate, templateNames, mapOnlyIndex, templates;&lt;/P&gt;&lt;P&gt;layoutTemplate = arrayUtils.filter(resp.parameters, function (param, idx) {&lt;BR /&gt; return param.name === "Layout_Template";&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;if (layoutTemplate.length === 0) {&lt;BR /&gt; console.log("print service parameters name for templates must be \"Layout_Template\"");&lt;BR /&gt; return;&lt;BR /&gt; }&lt;BR /&gt; templateNames = layoutTemplate[0].choiceList;&lt;/P&gt;&lt;P&gt;// remove the MAP_ONLY template then add it to the end of the list of templates&lt;BR /&gt; mapOnlyIndex = arrayUtils.indexOf(templateNames, "MAP_ONLY");&lt;BR /&gt; if (mapOnlyIndex &amp;gt; -1) {&lt;BR /&gt; var mapOnly = templateNames.splice(mapOnlyIndex, mapOnlyIndex + 1)[0];&lt;BR /&gt; templateNames.push(mapOnly);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;// create a print template for each choice&lt;BR /&gt; templates = arrayUtils.map(templateNames, function (ch) {&lt;BR /&gt; var plate = new PrintTemplate();&lt;BR /&gt; plate.layout = plate.label = ch;&lt;BR /&gt; plate.format = "PDF";&lt;BR /&gt; plate.layoutOptions = {&lt;BR /&gt; "authorText": "Made by: Esri's JS API Team",&lt;BR /&gt; "copyrightText": "&amp;lt;copyright info here&amp;gt;",&lt;BR /&gt; "legendLayers": [],&lt;BR /&gt; "titleText": "Pool Permits",&lt;BR /&gt; "scalebarUnit": "Miles"&lt;BR /&gt; };&lt;BR /&gt; return plate;&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;// create the print dijit&lt;BR /&gt; app.printer = new Print({&lt;BR /&gt; "map": app.map,&lt;BR /&gt; "templates": templates,&lt;BR /&gt; url: app.printUrl&lt;BR /&gt; }, dom.byId("print_button"));&lt;BR /&gt; app.printer.startup();&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;function handleError(err) {&lt;BR /&gt; console.log("Something broke: ", err);&lt;BR /&gt; }&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sai Anand Peketi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Aug 2019 10:30:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3733#M326</guid>
      <dc:creator>SaiPeketi</dc:creator>
      <dc:date>2019-08-06T10:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Printing secured services...</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3734#M327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for reply @&lt;A _jive_internal="true" class="" data-userid="5339" data-username="mcin8130" href="https://community.esri.com/people/mcin8130"&gt;Bryan McIntosh&lt;/A&gt;. I tried to change the recycle interval but not a success.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Aug 2019 10:32:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/printing-secured-services/m-p/3734#M327</guid>
      <dc:creator>SaiPeketi</dc:creator>
      <dc:date>2019-08-06T10:32:24Z</dc:date>
    </item>
  </channel>
</rss>

