Feature Service Error related to javascript api

3301
8
01-31-2013 07:11 AM
EvanKarmazin
New Contributor
While trying to add a feature service widget that is partly based off of
[HTML]http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/#sample/ed_default_editingwidget[/HTML]
and partly based off of an existing page. While the feature layers do appear in the toolbar/content pane. I currently am getting an error when I try to do the doubleclick that sends the information to the server

I beleive this results from incorrect input parameters being sent due to this page:
[HTML]http://resources.arcgis.com/en/help/main/10.1/index.html#/Task_operation_execute_REST/0057000000m500...

The form data sends is :
f:json
adds:[{"geometry":{"rings":[[[-9163974.606536975,4639277.6829617545],[-9156961.509191819,4634863.444578291],[-9166363.263670884,4627678.363919495],[-9166879.213611808,4640099.381015819],[-9163974.606536975,4639277.6829617545]]],"spatialReference":{"wkid":102100}},"attributes":{"PROBKEY":"SP","COMMENTS":null,"PADNUMBER":null,"PADNAME":null,"AREA_":null,"DEPTH":null,"VOLUME":null,"STATUS":null,"UPDATEDBY":null,"DATEUPDATED":null}}]

Here is the code which may be responsible for the error:
 function initEditor(results) {
 var templateLayers = dojo.map(results,function(result){
          return result.layer;
        });
 
 var templatePicker = new esri.dijit.editing.TemplatePicker({featureLayers: templateLayers,     
                rows: "auto",
                columns: 3
                },'editingDiv');
 templatePicker.startup();
var layerInfos = dojo.map(results, function(result) {
          return {'featureLayer':result.layer};
        });
        


        var settings = {
          map: map,
          geometryService: new esri.tasks.GeometryService("/arcgis/rest/services/Utilities/Geometry/GeometryServer"),
    templatePicker: templatePicker,
    layerInfos: layerInfos,
    
        };
        var params = {
          settings: settings
        };
        editorWidget = new esri.dijit.editing.Editor(params);
        
        var options = {snapKey:dojo.keys.copyKey};
        map.enableSnapping(options);
        
        editorWidget.startup();
      }


The error is below.
Error {code: 400, message: "Unable to complete operation.", details: Array[0], log: undefined}
_ssl: undefined
arguments: undefined
code: 400
details: Array[0]
get stack: function () { [native code] }
log: undefined
message: "Unable to complete operation."
set stack: function () { [native code] }
type: undefined
__proto__: d
 serverapi.arcgisonline.com:15
_48f serverapi.arcgisonline.com:15
(anonymous function) serverapi.arcgisonline.com:15
_1e1 serverapi.arcgisonline.com:15
_1df serverapi.arcgisonline.com:15
resolve.callback serverapi.arcgisonline.com:15
_1e1 serverapi.arcgisonline.com:15
_1df serverapi.arcgisonline.com:15
resolve.callback serverapi.arcgisonline.com:15
_1e1 serverapi.arcgisonline.com:15
_1df serverapi.arcgisonline.com:15
resolve.callback serverapi.arcgisonline.com:15
_1e1 serverapi.arcgisonline.com:15
_1df serverapi.arcgisonline.com:15
resolve.callback serverapi.arcgisonline.com:15
rDfd.then.otherwise._49d.error serverapi.arcgisonline.com:15
_4b9 serverapi.arcgisonline.com:15
_4b3 serverapi.arcgisonline.com:15
resolve serverapi.arcgisonline.com:15
_4c0 serverapi.arcgisonline.com:15
_4b9 serverapi.arcgisonline.com:15
_4b3 serverapi.arcgisonline.com:15
resolve serverapi.arcgisonline.com:15
_4c0 serverapi.arcgisonline.com:15
_4b9 serverapi.arcgisonline.com:15
_4b3 serverapi.arcgisonline.com:15
resolve serverapi.arcgisonline.com:15
_4c0 serverapi.arcgisonline.com:15
_4b9 serverapi.arcgisonline.com:15
_4b3 serverapi.arcgisonline.com:15
resolve serverapi.arcgisonline.com:15
_3dd serverapi.arcgisonline.com:15
_3e9 serverapi.arcgisonline.com:15

and the code in the init that is related to the init editor
dojo.connect(map, "onLayersAddResult", initEditor);
 var operationsPointLayer = new esri.layers.FeatureLayer("/arcgis/rest/services/app_services/AMLedit/FeatureServer/0", {
  id: "amlPoints",
          mode: esri.layers.FeatureLayer.MODE_SELECTION,
          outFields: ["*"]
    
        });
        var operationsLineLayer = new esri.layers.FeatureLayer("/arcgis/rest/services/app_services/AMLedit/FeatureServer/1", { 
   id: "amlLines",
         mode: esri.layers.FeatureLayer.MODE_SELECTION,
         outFields: ["*"],
   
        });
        var operationsPolygonLayer = new esri.layers.FeatureLayer("/arcgis/rest/services/app_services/AMLedit/FeatureServer/2", {
   id: "amlPolygon",
          mode: esri.layers.FeatureLayer.MODE_SELECTION,
          outFields: ["*"],
    
        });
   var operationsProblemsLayer = new esri.layers.FeatureLayer("/arcgis/rest/services/app_services/AMLedit/FeatureServer/3", {
   id: "amlPolygon",
          mode: esri.layers.FeatureLayer.MODE_SELECTION,
          outFields: ["*"],
    
        });
  map.addLayers([operationsPointLayer, operationsPolygonLayer, operationsLineLayer,operationsProblemsLayer]);

I am pretty confident that something needs to be tweaked in initeditor. I just am not sure what at this point
0 Kudos
8 Replies
EvanKarmazin
New Contributor
After further testing it would appear that everything is working the way that it should. The main issue appears to be figuring out how to send it using a proxy properly.
0 Kudos
EvanKarmazin
New Contributor
I just realized that it is not currently sending the information with a proxy. I have played with the proxy. but it is not currently working correctly.
0 Kudos
JohnGravois
Frequent Contributor
i've always found it helpful to debug proxies directly in the browser.  if the global mustMatch tag in the proxy.config is set to "false" you should be able to navigate to a page like this directly..

http://[webserver]/proxy/proxy.ashx?http://www.esri.com
0 Kudos
EvanKarmazin
New Contributor
On friday, I tried the apply edit page on feature server page and the same error showed up. I will work on seeing if it is an issue in regards to fields matching between the post and the settings within the feature server/arcmap. Or at least that is the plan.

I will post with my results, which I hope to have within a couple days. As it may help someone down the road.

Thanks for the advice, I may try that in the coming days
0 Kudos
EvanKarmazin
New Contributor
"id": "MO",
   "name": "Mine Openings",
   "domains": {
    "PROBKEY": {"type": "inherited"}
   },
   "templates": [
    {
     "name": "Mine Openings",
     "description": "",
     "prototype": {
      "attributes": {
       "PROBKEY": "MO",
       "COMMENTS": null,
       "PADNUMBER": null,
       "PADNAME": null,
       "X": null,
       "Y": null,
       "ROTATION": null,
       "STATUS": null,
       "UPDATEDBY": null,
       "DATEUPDATED": null
      }
     },
     "drawingTool": "esriFeatureEditToolPoint"
    }


Could it be that the domains is causing the issue?
0 Kudos
DianaBenedict
Occasional Contributor III
Quick question: you points feature Layer, what geometry type is it?  is it a mulitpoint? if so, the out-of-the-box ESRI editor does not support multipoint creation, it only creates simple points, lines or polys. multipoints expect a point array input.  You will need to create a custom add tool in order to create and edit multipoint features using the esri.toolbars.edit and esri.toolbars.draw functionality.

Something else to look at is to make sure that you can edit your SDE data directly from within the MXD that you used to publish your feature services.  I found in some cases that I had not set up the edit environment/feature templates correctly and couldn't even edit from within ArcMap. Once I fixed those issue everything else worked fine.

Good Luck
EvanKarmazin
New Contributor
Quick question: you points feature Layer, what geometry type is it?  is it a mulitpoint? if so, the out-of-the-box ESRI editor does not support multipoint creation, it only creates simple points, lines or polys. multipoints expect a point array input.  You will need to create a custom add tool in order to create and edit multipoint features using the esri.toolbars.edit and esri.toolbars.draw functionality.

Something else to look at is to make sure that you can edit your SDE data directly from within the MXD that you used to publish your feature services.  I found in some cases that I had not set up the edit environment/feature templates correctly and couldn't even edit from within ArcMap. Once I fixed those issue everything else worked fine.

Good Luck


As far as I can tell they are just regular points/lines/polygons. I can edit it after I start the editing tool bar in arc map. And I can edit the vertices as well in arcmap. Thanks for ideas
0 Kudos
SamirGambhir
Occasional Contributor III
i've always found it helpful to debug proxies directly in the browser.  if the global mustMatch tag in the proxy.config is set to "false" you should be able to navigate to a page like this directly..

http://[webserver]/proxy/proxy.ashx?http://www.esri.com


Hi John,
I had some issues with my application which was working fine till last week. In order to find the problem, I was searching this forum and found your post. The issue is that my combobox, which should get populated dynamically when the application loads, is failing in the first attempt. However, refreshing the page helps populate it, but again fails in the next refresh and so on.....I have looked at my code and there doesn't seem to be anything different from last week. As part of solution hunting, I decided to look into proxy page setting.
I am using proxy.jsp. When I use the url as suggested by you above, the console log says "500 Internal server error". What could be the issue? I am using Server 10.1 Javascript API 3.2.
Thanks for your help in advance
Samir
0 Kudos