QueryTask - Error Code 400 Message Unable to complete operation - Random?

10727
7
Jump to solution
11-06-2012 06:00 AM
AntonioSergio
Esri Contributor
Hi all,

I'm getting crazy with the following situation:

Test Environment:
Windows 7 64 bits
ArcGIS Server 10.1 SP1

1)I have a simple query in the bellow url:
http://clt0039/arcgis/rest/services/DGIP/DGIPPredios/MapServer/0/query?f=json&where=Edificio%20%3D%2...

2)I copied the url to the browser (firefox,IE,Chrome), and the first time all worked fine:
{"displayFieldName":"Denominaca","fieldAliases":{"Denominaca":"Denominação"},"geometryType":"esriGeometryPoint","spatialReference":{"wkid":102100,"latestWkid":3857},"...etc...

3)I made Enter again in the url (Second time) and an error occoured:
{"error":{"code":400,"message":"Unable to complete operation.","details":[]}}

4)I made Enter again in the url (third time) and all worked fine:
{"displayFieldName":"Denominaca","fieldAliases":{"Denominaca":"Denominação"},"geometryType":"esriGeometryPoint","spatialReference":{"wkid":102100,"latestWkid":3857},"...etc...

5)I made Enter again in the url (Forth time) and an error occoured:
{"error":{"code":400,"message":"Unable to complete operation.","details":[]}}

...worked fine,  next -> error,  next -> worked fine, next -> error,.......

If i change something (ex: id to find or the wkid etc..) in the url before every Enter always works fine,

Thanks in advance,

António Sérgio
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
StevenMoore1
Esri Contributor
This is actually a known issue which is logged as the following bug:

[ NIM086349 - Alternate Query (Get) requests fail in Version 10.1 SP1 ]

I'm not sure when this bug will be fixed, but it has a high severity level and is currently being addressed.

View solution in original post

0 Kudos
7 Replies
AntonioSergio
Esri Contributor
The workaround for that situation was to add always a random value to all the querys:

var queryTask = new esri.tasks.QueryTask(queryUrlParameterLayer);

var random = (new Date()).getTime();
  
  
var query = new esri.tasks.Query();
query.where = "Edificio = " + predioid + " AND " + random + "=" + random;
query.returnGeometry=true;
query.outSpatialReference = {"wkid": 102100};
.....

URL :
http://clt0039/arcgis/rest/services/DGIP/DGIPPredios/MapServer/0/query?f=json&where=Edificio%20%3D%2...

Anyone can explain me this?
0 Kudos
HarshalGharat
New Contributor III
António,
I had also faced the same issue but could not get the root cause. However you can avoid the error if you query (POST).

Thanks
Harshal Gharat
0 Kudos
IanHamilton
New Contributor
Hi I hope someone is still following this thread

How to Query (POST)?
0 Kudos
ChristianMorin
New Contributor III
I have the same issue but found the following solution:

I'm using the Siverlight API QueryTask and setting:
     queryTask.DisableClientCaching = true;
works (it appends a ts parameter with a random number to every request, so etags don't come into play).

Cheers,
Christian.
0 Kudos
StevenMoore1
Esri Contributor
This is actually a known issue which is logged as the following bug:

[ NIM086349 - Alternate Query (Get) requests fail in Version 10.1 SP1 ]

I'm not sure when this bug will be fixed, but it has a high severity level and is currently being addressed.
0 Kudos
JoseThomas
New Contributor
This problem occurs only when the data of the MapService is FileGDB based or data is not copied to the server while publishing.

You can workaround this using either of these
1) Choose copy data to the Server while publishing the service
2) Change to Enterprise GDB
3) Change the service configuration to set "hasStaticData": "true", if your service data doesn�??t change.
               http://hostname:6080/arcgis/admin/services/WorldCities.MapServer/edit
0 Kudos
BogiBjornsson
Occasional Contributor
This problem occurs only when the data of the MapService is FileGDB based or data is not copied to the server while publishing.

You can workaround this using either of these
1) Choose copy data to the Server while publishing the service
2) Change to Enterprise GDB
3) Change the service configuration to set "hasStaticData": "true", if your service data doesn�??t change.
               http://hostname:6080/arcgis/admin/services/WorldCities.MapServer/edit


I had a Silverlight API application on 10.1 SP1 server and it was causing problems to a specific dynamic service (with static data content) when using the Identify tool. Would give the "Unable to complete operation" message in a message box when turning layers on and off and such.

By doing what you suggested in point 3, setting the "hasStaticData" parameter to "true", solved the issue. Thanks.
0 Kudos