PrintTask not working in Web App Builder

858
3
Jump to solution
12-06-2017 03:00 AM
mohannainar1
New Contributor III

Hi ,

Below is the code I am using it for PrintTask

var url = "https://servername:6443/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20T...";
var printTask = new PrintTask(url);
var params = new PrintParameters();
var template = new PrintTemplate();
template.format = "PDF";
template.layout = "MAP_ONLY";
template.preserveScale = false;
template.layoutOptions = {"legendLayers": [], 
"titleText": "Map Print",
"authorText": "AAAAA",
"copyrightText": "BBBBB",
"scalebarUnit": "Kilometers"};
params.map = this.map;
params.template = template;
printTask.execute(params, lang.hitch(this, this._printResult),lang.hitch(this, this._printResultError));

_printResultError:function(err)
{
debugger;
alert(err);
},
_printResult:function(res){
debugger;
window.open(res.url, "_blank")
},

I am getting the following error 

"Error executing tool. Export Web Map Task : Layer "ServiceName": Unable to connect to map server at https://servername:6443/arcgis/rest/services/ServiceName/MapServer.
Failed to execute (Export Web Map).
Failed to execute (Export Web Map Task)."

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Mohan,

   Do you have Web Adaptor installed on your server? If you do then you should be using the web adaptor url and not the "https: //servername:6443/arcgis/rest/services" url. Is that map service secured?

View solution in original post

3 Replies
mohannainar1
New Contributor III

Getting same error in Print Widget also , kindly refer the attached screen shot . 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Mohan,

   Do you have Web Adaptor installed on your server? If you do then you should be using the web adaptor url and not the "https: //servername:6443/arcgis/rest/services" url. Is that map service secured?

mohannainar1
New Contributor III

Yes web adaptor was installed . Map service is not secured. Thanks for the help robert its working.

0 Kudos