Select to view content in your preferred language

Error when using PrintTask from PrintingTools

2662
3
08-31-2015 12:37 AM
WoraminSattayatharn1
Emerging Contributor

Greetings

I need some help about calling PrintingTools from GeoprocessingServices by using PrintTask Class from ArcGIS API. When I call PrintingTool from using PrintTask by using ArcGIS API javascript, sometimes it comes back with an error.

======================================================

In my website, there is one function that can save the image from current Map Application. Sometimes it needs to produce numbered pin for locating various places. Sometimes, it is around 20-30 pins. It can go up to around 1000 pins in some cases. (Example is the below images). Then I used PrintTask to call PrintingTools to produce the map image.

map_result1.jpg

map_result2.jpg

The problem is sometimes, there is an error callback from PrintingTool like the below image. When error is going to happen, it always take a lot of time for PrintTask for calling PrintingTool until it sent back an error.

map_result3.jpg

This error also occurs even with the same number of pin on map. For example, if there were 10 pins on map. When calling PrintingTool, sometimes it worked, sometimes it didn't and also had an error callback. Sometimes even 1000 pins worked while only 5 pin didn't.

When I try to check the error, I'm not sure whether it is related to the parameter that are sent to PrintingTool? I saw that sometimes some parameters are lost, like in the below image.There is no parameter "Web_Map_as_JSON" even though the source stated that it also send this parameter on Json

Parameters when somehow it didn't work

map_result4.jpg

Parameters when it worked

map_result5.jpg

Since I always send these parameters (Format, Layout, Map object) to the PrintTask to call PrintingTool. I'm not sure whether there is any external factors rather than my coding that affects the output.

I try to google the problems but no lucks, so I decided to post question here.

I hope that someone can help me explain the cause or give me some solutions to this problem

Thank you.

0 Kudos
3 Replies
thejuskambi
Frequent Contributor

I am not really sure what the problem is. But, my best guess is that the service is returning something other than json response, may be a 404 html page which contains the '<' tag. In fiddle, check what response did you get for the request.

Also check the service logs, and see if there are any error messages there. Hope this was helpful.

0 Kudos
WoraminSattayatharn1
Emerging Contributor

The problem is I cannot access service logs in ArcGIS Server Manager at customer's site. The administrator didn't give me an authorization.

By the way, this error often occurs at customer's site only. In my development site, only 1 in 100 times this error would occur, even though I can access service logs at my development site, I really need to hope that somehow this error could occur here too...

However this error happened especially when a lot of people try to test my app. So I'm doubting this error might come from when a lot of people are using my app to produce map image.

0 Kudos
thejuskambi
Frequent Contributor

Did you check the response data? Like I said earlier, when the JS API  get a response which was unexpected, you get this error.

0 Kudos