URGENT HELP NEEDED!!! Error code 400

2704
7
04-03-2013 12:17 PM
SamirGambhir
Occasional Contributor III
Hi all,
I have been working on this web application for sometime and I have a big presentation coming up next Wednesday. Unfortunately, starting last week, something has gone wrong with the application and I cannot fix it. The issue is that when my application loads, the console log shows "Error {code: 400, message: "Unable to complete operation.", details: Array[0], log: undefined, _ssl: undefined}. Suspecting something wrong with my code, I have checked my code umpteenth number of times. I also recreated my services and checked through REST as well. Eventually I created a basic bare bones application and tried it with ESRI's SampleWorldCities service, and I still get the same message. I suspect there is something going on with serverapi.arcgisonline.com. if not, then can someone help me resolve this issue. I have spent two days trying to resolve this and cannot progress on completing my application.

I'll really appreciate any help. PLEASE HELP!
Thanks
Samir
0 Kudos
7 Replies
ShadCampbell
New Contributor III
Can you post your code?
Are you using both http and https requests?
0 Kudos
SamirGambhir
Occasional Contributor III
Can you post your code?
Are you using both http and https requests?


Hi Shad,
Thanks for offering to help. Please find the html file with a very basic application.
I am using http requests only.
Thanks
Samir
0 Kudos
ShadCampbell
New Contributor III
Samir,
It does not appear to be anything with the JSAPI... This seems to work fine: http://jsfiddle.net/shadc/WD6ta/ .  All I did is point to another SampleWorldCities service??  Your service or proxy is suspect... ("http://localhost:6080/arcgis/rest/services/SampleWorldCities/MapServer/0")  Are you running everything from localhost?

-Shad
SamirGambhir
Occasional Contributor III
Samir,
It does not appear to be anything with the JSAPI... This seems to work fine: http://jsfiddle.net/shadc/WD6ta/ .  All I did is point to another SampleWorldCities service??  Your service or proxy is suspect... ("http://localhost:6080/arcgis/rest/services/SampleWorldCities/MapServer/0")  Are you running everything from localhost?

-Shad


Hi Shad,
Thanks for looking into it.
I ran the code on JSFiddle (your link) and the behavior is the same. It runs fine the first time, but if you run it again, the combobox does not get populated. Did you encounter the same behavior?
Thanks
Samir
0 Kudos
ShadCampbell
New Contributor III
While I don't have a solution, I might be able to lead you in the right direction...

I stripped your code down to the bare minimum to test simple queries and found the same as you did... that every other request results in a 400 error. 

As simple Google search found me the REST endpoints for several SampleWorldCities services.   So I tried a bunch of them and found that most of them failed... but one worked.  The ones on version 10.11 failed, but the one on 10.1 worked!
Try for yourself...
http://jsfiddle.net/shadc/4VZeQ/

I then went directly to ArcGIS Server and hand entered the queries... and found the same results with THAT (ie SampleWorldCities) service, but only with a get request... the post worked every time.

http://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer/0/query
Where: CITY_NAME = 'New York'
--FAILS ON EVERY OTHER QUERY (with get only)--

In fact, I tested all the layers in the service and they all fail on every other get request.  I then tested several other MapServer services on that server that appeared similar to the SampleWorldCities service and did not have any issues with multiple requests with either the get or post.

Bottom line... it appears to be an issue with this server version and this service.  Perhaps just find another source for the data?
Perhaps this will help with tech support.

Good luck,
Shad
0 Kudos
StephenLead
Regular Contributor III
I tested all the layers in the service and they all fail on every other get request


You may have encountered a bug in ArcGIS Server 10.1 SP1:

http://forums.arcgis.com/threads/73456-new-problem-REST-query-10.1-every-other-request-fails-(400-un...


This is a known issues with 10.1 SP1, and has been logged as the following bug:

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

I don't know when this is scheduled to be fixed, but if you contact Support you can be attached to the bug. You can also check the status here:

http://support.esri.com/en/bugs/nimb...1/TklNMDg2MzQ5

0 Kudos
SamirGambhir
Occasional Contributor III
You may have encountered a bug in ArcGIS Server 10.1 SP1:

http://forums.arcgis.com/threads/73456-new-problem-REST-query-10.1-every-other-request-fails-(400-un...


Thanks all,
I figured there was a small piece of code missing in my init function:
esriConfig.defaults.io.alwaysUseProxy = true;

Once I placed this code, the site started working normally on my local install with no problems, so far (I'll keep my fingers crossed).

However, I now have to host it on amazon EC2 and I am not sure what should be the proxyURL on EC2. My path to the file on EC2 is  "http://<ElasticIPAddress>/ArcGIS_proxy/proxy.jsp. I have tried a few options but those didn't work. I am using a web adaptor for this instance.

I'll post this question on the appropriate forum as well, but wanted to follow up on my question on this forum.

Thanks
Samir
0 Kudos