Select to view content in your preferred language

Geoprocessing Service Fails

825
0
05-31-2012 08:24 AM
MichaelKohler
Frequent Contributor
Hi,
I have a geoprocessing service that uses a python script to export a map to a pdf that is called from a silverlight app. I had everything working ok and was asked to add a few text lables to the map. I added the new labels to the map and the parameters to the script. The problem is the script returns Failed... when ever it is run by the silverlight app. If I run it from within arc catalog and supply the parameters, everything works fine. If I comment out the lines of code getting the parameter it works from silverlight. If I uncomment the arcpy.GetParameterAsText(8) line it fails. It's like it can't even get the parameters that I added and it fails.

The code from silverlight is below
            List<GPParameter> param = new List<GPParameter>();
            param.Add(new GPDouble("xMin",MyMap.Extent.XMin));
            param.Add(new GPDouble("yMin", MyMap.Extent.YMin));
            param.Add(new GPDouble("xMax", MyMap.Extent.XMax));
            param.Add(new GPDouble("yMax", MyMap.Extent.YMax));
            param.Add(new GPString("SpatialReference", MyMap.SpatialReference.WKID.ToString()));
            param.Add(new GPString("Scale", "0"));
            param.Add(new GPString("MapTitle", add_text.Text.ToString().ToUpper()));
            param.Add(new GPString("lyrList", getMappedLayers()));
            param.Add(new GPString("firmPanel", firmPanel.ToString()));
            param.Add(new GPString("firmMap", firmMap.ToString()));
            param.Add(new GPString("firmSuf", firmSuf.ToString()));
           
            geoprocessorTask.SubmitJobAsync(param);

The lines for the "new" parameters are the last 3 lines. firmPanel, firmMap and firmSuf are all defined as strings. I thought I'd add ToString() just to try something!!!!


The python code is below
    #get the FIRM information
    firmPan = arcpy.GetParameterAsText(8)
    firmMap = arcpy.GetParameterAsText(9)
    firmSuf = arcpy.GetParameterAsText(10)

    # Set the text
    if title != " ":
        for elm in arcpy.mapping.ListLayoutElements(mapDoc, "TEXT_ELEMENT"):
            if elm.text == "FIRM Panel":
                elm.text = "FIRM Panel: " + firmPan
            elif elm.text == "FIRM Map":
                elm.text = "FIRM Map: " + firmMap
            elif elm.text == "FIRM Suffix":
                elm.text = "FIRM Suffix: " + firmSuf



FIXED: as usual... it was something stupid that I forgot to do. I added the parameters to the script properties so it would expect them but forgot to check that the geoprocessing service was expecting them. I had to restart the GPService, clear the rest cache and check to make sure the parameters were listed. Now that the GPService is expecting them, it works.
Tags (2)
0 Kudos
0 Replies