Note that there are some explanatory texts on larger screens.

plurals
  1. POesri javascript asynchronous print
    primarykey
    data
    text
    <h1>The Setup:</h1> <p>I am using the <a href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/printtask.htm" rel="nofollow">javascript API v. 2.8 from ESRI</a>, which itself uses the <strong>dojo toolkit v. 1.6</strong>. I have the <a href="http://resources.arcgis.com/en/help/main/10.1/index.html#//0154000005z2000000" rel="nofollow">ArcGIS Server v. 10.1</a> running on Windows in Amazon's EC2.</p> <p>I can successfully execute a PrintTask with javascript that POSTs JSON to my server, which runs a process and returns a PDF to the client-browser. But this request is <em>synchronous</em> and can take a minute or two, causing <strong>Heroku</strong> to timeout with an H12 error.</p> <h1>The Problem:</h1> <p>When I toggle the [ ] Asynchronous checkbox to <strong>ON</strong> on the ArcGIS server, my PrintTask returns:</p> <pre><code>{"error":{"code":500,"message":"Error performing execute operation","details":[]}} </code></pre> <p>I'm not sure where to go from here. Does anybody have any examples or experience running an asynchronous print task on ArcGIS server?</p> <p>The javascript for the printTask is below. Is there a way to re-write this javascript to be more asynchronous, or "non-blocking"?</p> <h1>The code</h1> <p><em>(stripped down for brevity)</em></p> <pre><code>dojo.require("esri.tasks.PrintTask"); function Print() { var printTool = this; this.executePrint = function(){ var params = new esri.tasks.PrintParameters(); params.map = map; params.template = selectedTemplate; printTask = new esri.tasks.PrintTask(printUrl, {async: true}); printTask.execute(params, printTool.printComplete, printTool.printError); }; this.printComplete = function(result){ dojo.place("&lt;div&gt;&lt;a href='" + result.url + "'&gt;&lt;/a&gt;&lt;/div&gt;", printForm, "last"); }; this.printError = function(err){ dojo.byId("printJob").innerHTML = err; }; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload