I have a geoprocessing model that accept 3 parameters [layer as layerfile, clipfeatures as shape file and outputF as string]. This model clips the layer by the clipfeatures shape file and then exports the result. WHen running the model from arcInfo the model works fine but I need to call it from an Arcobjects webservices. The problem is that I am receiving a com exception error. Attached you will find the code, please help me, what is wrong with the code? The model is attached too
public string GeoprocessingLayerClipAndExport()
{
try
{
//Call Geoprocessing model
ESRI.ArcGIS.Geoprocessor.Geoprocessor GP = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();
GP.AddToolbox(@"C:\Users\xxxx\Desktop\LEMIS\Geoprocessing\Export.tbx");
// Generate the array of parameters.
IVariantArray parameters = new VarArrayClass();
parameters.Add(@"C:\temp\test.lyr"); //input layer
parameters.Add(@"C:\temp\clipexport\ClipF.shp"); //shape file
parameters.Add("SHAPE, C:\\temp\\exportshape\\"); //export
GP.OverwriteOutput = true;
GP.Execute("ClipandExport", parameters, null);
return "ok";
}
catch (Exception ex)
{
return "error";
}
}