Upload FeatureSet to Server

1734
7
07-23-2012 11:10 AM
MattGiles
New Contributor
I am trying to upload a graphics layer to a gdb on our local server through a geoproc service..

1.In flex, i make a new feature set from the graphics layer. I then build my parameters and execute the geoprocessing task.
var myGL:GraphicsLayer = resultsList[resultLayerDataGrid.selectedIndex].graphicLayer;
    var fs:FeatureSet = new FeatureSet(ArrayCollection(myGL.graphicProvider).toArray())
     
     var params:Object =
     {
      "aFeatureSet": fs
     };
    
     gp.execute(params); 
 


2. My service runs from the following script:
import arcpy
from arcpy import env

userName = "mgiles"

env.workspace = "C:\\Users\\Administrator.GIS\\AppData\\Roaming\\ESRI\\Desktop10.0\\ArcCatalog\\" + userName + '.sde'
env.overwriteOutput = True

aFeatureSet = arcpy.GetParameter(0)

anOutput="output"

arcpy.CopyFeatures_management(aFeatureSet, anOutput)


I have attached an image of the service from the rest services directory. The script works from desktop. When i run it from Flex it returns the error: [RPC Fault faultString="Error Executing Task. Error processing message" faultCode="500" faultDetail=""].

Could someone point me in the right direction as to what im doing wrong? Thanks.

[ATTACH=CONFIG]16340[/ATTACH]
Tags (2)
0 Kudos
7 Replies
AnthonyGiles
Frequent Contributor
M Giles,

Just a quick point without delving to far, the problem could be the path on your env.workspace it must be accessible by your server. Try using a UNC path or a %scratchworkspace%

Regards

Anthony
0 Kudos
MattGiles
New Contributor
Thanks Anthony for the quick reply,

Unfortunately same result using both UNC and scratch workspace..
0 Kudos
AnthonyGiles
Frequent Contributor
Have you tried turning on Verbose logging in Server manager, this may give you more detail on what is causing the error

Regards

Anthony
0 Kudos
MattGiles
New Contributor
All the logs tell me is:

<Msg time='2012-07-24T10:23:14' type='ERROR' code='1017' target='SERVICES/MoveLayerToGroup.GPServerSync' thread='4424'>Container  process 12436 has crashed on machine geoserver.</Msg>
0 Kudos
AnthonyGiles
Frequent Contributor
Are you sure you have verbose logging on as you would normally expect a lot more details on the error
0 Kudos
OttarViken_Valvåg
New Contributor III
I've wasted many hours trying to pass feature sets to geoprocessing services through the REST API - it often gives me that error message, and there are no logs showing what goes wrong. But apparently it's the process of converting the json to something that can be processed by the python script.

One workaround I've found that always works is to create a model in model builder that just wraps my python script. In model builder you can specify a schema for your feature set, and this seems to make things ok. So instead of consuming the script tool from REST I consume the model tool, and the model handles the communication with the script tool.
0 Kudos
JORGELAGOS2
New Contributor
Did you create a widget to Export the Graphis as a FeatureClass? If so, could you share it?

Thanks







I am trying to upload a graphics layer to a gdb on our local server through a geoproc service..

1.In flex, i make a new feature set from the graphics layer. I then build my parameters and execute the geoprocessing task.
var myGL:GraphicsLayer = resultsList[resultLayerDataGrid.selectedIndex].graphicLayer;
    var fs:FeatureSet = new FeatureSet(ArrayCollection(myGL.graphicProvider).toArray())
     
     var params:Object =
     {
      "aFeatureSet": fs
     };
    
     gp.execute(params); 
 


2. My service runs from the following script:
import arcpy
from arcpy import env

userName = "mgiles"

env.workspace = "C:\\Users\\Administrator.GIS\\AppData\\Roaming\\ESRI\\Desktop10.0\\ArcCatalog\\" + userName + '.sde'
env.overwriteOutput = True

aFeatureSet = arcpy.GetParameter(0)

anOutput="output"

arcpy.CopyFeatures_management(aFeatureSet, anOutput)


I have attached an image of the service from the rest services directory. The script works from desktop. When i run it from Flex it returns the error: [RPC Fault faultString="Error Executing Task. Error processing message" faultCode="500" faultDetail=""].

Could someone point me in the right direction as to what im doing wrong? Thanks.

[ATTACH=CONFIG]16340[/ATTACH]
0 Kudos