I have an Silverlight application from which I'm trying to create new features to ArcGIS server. Every time I get error
{\"error\":{\"code\":400,\"message\":\"Unable to complete operation.\",\"details\":[\"Invalid parameters\"]}}
My request code is like this:
System.Net.WebClient client = new System.Net.WebClient();client.Headers["Content-type"] = "application/x-www-form-urlencoded";client.Encoding = System.Text.Encoding.UTF8;client.UploadStringCompleted += client_UploadStringCompleted;
client.UploadStringAsync(new Uri("http://.../FeatureServer/0/addFeatures?f=json&features"), "POST", JSONString);
If I copy the JSONString variable to a text editor, replace every escaped double quote mark (\") with double quote mark (") and use the ArcGIS servers /FeatureServer/0/addFeatures form, I am able to store the same features in that form to a featurelayer. That makes me thinking that the JSON data is well formed and valid for the featurelayer I'm using.
What could make the request response an error every time when called ArcGIS server from Silverlight application?
SOLVED:
I followed the instructions below and found a solution. First, the endpoint URL is like /.../FeatureServer/0/addFeatures, not like /.../FeatureServer/0/addFeatures?f=json?featuresfeatures=[{"geometry":{"x":0,"y":0}, "attributes":{"Id":"018-00","SV":"","Num":"4 A"}}]&f=json
Found the solution from here and by comparing the POST methods made from my application and the web form with Fiddler
أكثر...
{\"error\":{\"code\":400,\"message\":\"Unable to complete operation.\",\"details\":[\"Invalid parameters\"]}}
My request code is like this:
System.Net.WebClient client = new System.Net.WebClient();client.Headers["Content-type"] = "application/x-www-form-urlencoded";client.Encoding = System.Text.Encoding.UTF8;client.UploadStringCompleted += client_UploadStringCompleted;
client.UploadStringAsync(new Uri("http://.../FeatureServer/0/addFeatures?f=json&features"), "POST", JSONString);
If I copy the JSONString variable to a text editor, replace every escaped double quote mark (\") with double quote mark (") and use the ArcGIS servers /FeatureServer/0/addFeatures form, I am able to store the same features in that form to a featurelayer. That makes me thinking that the JSON data is well formed and valid for the featurelayer I'm using.
What could make the request response an error every time when called ArcGIS server from Silverlight application?
SOLVED:
I followed the instructions below and found a solution. First, the endpoint URL is like /.../FeatureServer/0/addFeatures, not like /.../FeatureServer/0/addFeatures?f=json?featuresfeatures=[{"geometry":{"x":0,"y":0}, "attributes":{"Id":"018-00","SV":"","Num":"4 A"}}]&f=json
Found the solution from here and by comparing the POST methods made from my application and the web form with Fiddler
أكثر...