mail2vajram

error while running a geoprocessing service using IGPServer

Discussion created by mail2vajram on Oct 31, 2012
I got the " the remote procedure call failed "error message while running the following code....

     

              //Here i am getting the polygon geometry from one featureclass......
               IGeometry queryGeom = getBasinGeometry(queryBasin);

                pservContext = SOM.CreateServerContext("ReportGen/buffer_clip", "GPServer");
                IGPServer pgpServer = pservContext.ServerObject as IGPServer;

                string taskName = "State_Clip";

                IGPToolInfo task = pgpServer.GetToolInfo(taskName);
                IGPValues taskValues = (IGPValues)pservContext.CreateObject("esriGeoprocessing.GPValues");
                IGPParameterInfos paramInfos = task.ParameterInfo;
                IGPParameterInfo paramInfo = null;
                string parameterStr = string.Empty;

                for (int i = 0; i < paramInfos.Count; i++)
                {
                    paramInfo = paramInfos.get_Element(i);
                    taskValues.Add(paramInfo.Value);
                    //add to parametername strin.....
                    parameterStr += paramInfo.Name;

                    if (i != paramInfos.Count - 1)
                    {
                        parameterStr += ";";
                    }
                }

                //Now start assigning input values....           
                IGPRecordSet gprecSet = (IGPRecordSet)taskValues.get_Element(0);
                IQueryFilter qf = pservContext.CreateObject("esriGeodatabase.QueryFilter") as IQueryFilter;
                gprecSet.RecordSet.Table.DeleteSearchedRows(qf);

                IRecordSet rs = gprecSet.RecordSet;
                IFields flds = rs.Fields;
                int shpIndx = flds.FindField("SHAPE");
                IField fld = flds.get_Field(shpIndx);
                ISpatialReference inputrs = fld.GeometryDef.SpatialReference;
                IRecordSetInit rsi = (IRecordSetInit)rs;
                ICursor cur = rsi.Insert();
                IRowBuffer rb = rsi.CreateRowBuffer();

                IPolygon iplgon = (IPolygon)pservContext.CreateObject("esriGeometry.Polygon");
                iplgon = queryGeom as IPolygon;

                //IPoint ipnt = (IPoint)pservContext.CreateObject("esriGeometry.Point");
                //ipnt.PutCoords(4099805.666, 3444416.24);
                //rb.set_Value(shpIndx, ipnt);

                rb.set_Value(shpIndx, iplgon);

                //exception is occuring here..........
                cur.InsertRow(rb);


If i run a same kind of tool with esriGeometryPoint datatype as Input featureset, Working fine. But the problem is only with polygon data type.

Any suggestion will be useful

Thanks
Srinivas...............

Outcomes