7 Replies Latest reply on Nov 15, 2010 7:41 PM by tanyg

    how to pass the parameter in silverlight about call GeoProcessing?

      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

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

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

      Parameter: Idw_1

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

      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);
                  FeatureSet fs = new FeatureSet(lstItems);
                  fs.SpatialReference = new SpatialReference(102100);

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

      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??
        • Re: how to pass the parameter in silverlight about call GeoProcessing?
          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.
          • Re: how to pass the parameter in silverlight about call GeoProcessing?
            first thanks a lot.
            i use the Fiddler ,and the json information is:

            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!
            • Re: how to pass the parameter in silverlight about call GeoProcessing?
              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??

              • Re: how to pass the parameter in silverlight about call GeoProcessing?
                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:


                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.
                • Re: how to pass the parameter in silverlight about call GeoProcessing?
                  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!


                  thank you very much again!
                  • Re: how to pass the parameter in silverlight about call GeoProcessing?
                    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).
                    • Re: how to pass the parameter in silverlight about call GeoProcessing?
                      thanks for your tip! i do that as your method!