how to pass the parameter in silverlight about call GeoProcessing?

769
7
11-11-2010 04:35 PM
tanyg
by
New Contributor
hi all
i build a GeoProcessing server in ModelBuilder:
i use the IDW in Raster Interpolation to convert some point to raster,and then publish it  to ArcGIS Server, in ArcGIS Desktop and Web Application ,call the GP it is ok, but in Silverlight C# , ERROR!

the rest info is :

Task: Model
Display Name: Model

Category:
Help URL:  http://demoserver/arcgisoutput/th/Model.htm
Execution Type: esriExecutionTypeAsynchronous
Parameters:
Parameter: Stations
Data Type: GPFeatureRecordSetLayer
Display Name: Stations
Direction: esriGPParameterDirectionInput
Default Value:

Geometry Type: esriGeometryPoint
Spatial Reference: 102100
Fields:
OBJECTID (Type: esriFieldTypeOID, Alias: OBJECTID)
SHAPE (Type: esriFieldTypeGeometry, Alias: SHAPE)
FVALUE (Type: esriFieldTypeInteger, Alias: FVALUE)
Parameter Type: esriGPParameterTypeRequired
Category:


Parameter: Idw_1

Data Type: GPRasterDataLayer
Display Name: Idw_1
Direction: esriGPParameterDirectionOutput
Parameter Type: esriGPParameterTypeRequired
Category:

and the call code is :
            GraphicsLayer graphicsLayer = (GraphicsLayer)myMap.Layers["test"];
          
            Random rand = new Random();
            List<Graphic> lstItems = new List<Graphic>();
            foreach (Graphic g in graphicsLayer.Graphics)
            {
                g.Attributes["FVALUE"] = rand.Next(1, 12);
                lstItems.Add(g);               
            }
            FeatureSet fs = new FeatureSet(lstItems);
            fs.SpatialReference = new SpatialReference(102100);

            lstParms.Add(new GPFeatureRecordSetLayer("Stations", fs));
            geoprocessorTask.SubmitJobAsync(lstParms);

especially, i want pass some points with attribute,and then according these point's attribute call the GP to generator IDW Raster,but how to pass the parameter??
thx
0 Kudos
7 Replies
JenniferNery
Esri Regular Contributor
What error message do you get?  Please try to use Fiddler to see that the GP parameters are correct and that you can run the same job from the web browser.  It should be similar to the steps described in post #14 on this thread: http://forums.arcgis.com/threads/14730-Area-And-Perimeter Run Fiddler and your SL app.
0 Kudos
tanyg
by
New Contributor
first thanks a lot.
i use the Fiddler ,and the json information is:

Stations={"geometryType":"esriGeometryPoint","spatialReference":{"wkid":102100},"features":[{"geometry":{"x":13381735,"y":3702724,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"8"}},{"geometry":{"x":13384167,"y":3696158,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"1"}},{"geometry":{"x":13372653,"y":3698329,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"2"}},{"geometry":{"x":13372947,"y":3694618,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"9"}},{"geometry":{"x":13376655,"y":3685459,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"10"}},{"geometry":{"x":13383735,"y":3685039,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"3"}},{"geometry":{"x":13372207,"y":3699378,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"8"}},{"geometry":{"x":13371507,"y":3698318,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"9"}},{"geometry":{"x":13372947,"y":3694618,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"6"}},{"geometry":{"x":13374367,"y":3694538,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"10"}},{"geometry":{"x":13384887,"y":3703838,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"8"}},{"geometry":{"x":13384167,"y":3696158,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"5"}},{"geometry":{"x":13383907,"y":3683678,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"8"}},{"geometry":{"x":13382467,"y":3687998,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"4"}},{"geometry":{"x":13376607,"y":3690378,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"7"}},{"geometry":{"x":13374229,"y":3696227,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"11"}},{"geometry":{"x":13370729,"y":3691187,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"10"}},{"geometry":{"x":13375337,"y":3685363,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"10"}}]}&f=json&
........
Especially ,in web application all is ok,
i guess the parameters i pass to the GP is not correct, and in json information the {"FVALUE":"10"}
is wrong, FVALUE should be integer type,here is string type???

can you show me a sample with how to pass the a lot of graphic with attribute to GP Service.
thanks very much!
0 Kudos
tanyg
by
New Contributor
hi all
i find the problem is not how to pass the parameters.
when i pass the parameters less than 9,all is correct,but  when more than 9 wrong!
and i find by using Fiddler when the parameters less than 9 ,the web method is "GET",but more than 9 the web method is "POST"??
and is there anywhere i can config or other??

thx!
0 Kudos
dotMorten_esri
Esri Notable Contributor
This smells like a bug in IE that ArcGIS Server exposes. Try it in FireFox and see if that works. If that's the case, try running this line of code when your app first starts up, and see if that doesn't fix it:

WebRequest.RegisterPrefix("http://www.myserver.com/arcgis/rest"WebRequestCreator.ClientHttp);

This basically forces Silverlight to perform the request for that domain instead of letting the browser do the work for it. Silverlight handles the response from ArcGIS server correctly.
0 Kudos
tanyg
by
New Contributor
thank you very much !
follow your method, i add "WebRequest.RegisterPrefix("http://www.myserver.com/arcgis/rest", WebRequestCreator.ClientHttp); "  before call the GP Service ,it's running correct,
and i increase the points to 5000,also correct!

FYI
http://blogs.msdn.com/b/silverlight_sdk/archive/2009/08/12/new-networking-stack-in-silverlight-3.asp...

thank you very much again!
0 Kudos
dotMorten_esri
Esri Notable Contributor
Don't call RegisterPrefix everytime you call the GP service. Only do it once (ie. at app startup or the first time you use the GP tool).
0 Kudos
tanyg
by
New Contributor
thanks for your tip! i do that as your method!
0 Kudos