Select to view content in your preferred language

Geoprocessing fails from silverlight

953
8
05-12-2011 05:56 PM
MuralidharMoka
Emerging Contributor
Hi ,

When I run my geoprocessing code from silveright , It fails
but when I go to geoprocessing service and submit the  jobs it runs sucessfully.

Note: I need to give the TRANS_ID in single quote when I run the geoproc service in the browser. double quote will fail. does it has any thing to do about my silverlight code failing.

The snap attached contains my silverlight code

Let me know if I should provide any more details. Because I could not figure out why this is happening.
0 Kudos
8 Replies
DominiqueBroux
Esri Frequent Contributor
From my understanding, the name of your parameter is 'Expression' and the value should be something like "TRANS_ID = '3'".

So your code should be:
parameters.Add(new GPString("Expression", string.Format("TRANS_ID='{0}'", transid);
0 Kudos
MuralidharMoka
Emerging Contributor
Thanks very much. Great support.

Muralidhar Moka
0 Kudos
DominiqueBroux
Esri Frequent Contributor
You are welcome. Thanks.
0 Kudos
MuralidharMoka
Emerging Contributor
Hi Dominique

After your input to change it to Expression, I tested the code.
Now I saw that my geoprocessing looks like working fine.
When I kept break on  geoprocessorTask_JobCompleted method.
I see it comes back.

But I saw that I get the status as failed when I look at the values for job status.(shown in snap)

If I got back to the browser and submit the job again. It runs sucessfully.

I have to give the the expression as shown in the snap shot.

For your reference I showed the rest definition also

Also Note that in my silverlight code I see the parameter value enclosed in double quote as u can see in snap

"TRANS_ID='17bec382-fd6b-44b7-9724-675f2d4334c2'""   (rest definition says this)

But in browser to run the job I need to give it like this,

TRANS_ID='17bec382-fd6b-44b7-9724-675f2d4334c2'  Then only it runs.

Has this any thing to do with the service failing when I run from silverlight code.

cannot figure out any thing.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
At first glance your code looks good, I don't see any difference between the expression you enter in the web page and the value you generated by code.

If you could use fiddler to look at the requests sent to the server, that could give a clue by comparing the working request and the  non working request.
0 Kudos
MuralidharMoka
Emerging Contributor
Hi Dominique,

To the GeoprocessingTask we sent the TRANSID ='3fc22379-ac83-47f2-aa2a-77a74d867a64'

We observed the URLS in fiddler, Here are the URL which we observed.

1) The url sent from silverlight code (The non working request)

gis.dev.fmh.com /ArcGISWeb/rest/services/Geoprocessing/ORACLE_FMH_CLU_SP11_GeoProc/GPServer/PivotBuffer/submitJob?Expression=TRANS_ID%3d%5cu00273fc22379-ac83-47f2-aa2a-77a74d867a64%5cu0027&f=json&

2) The url submitted from browser(The working request)
gis.dev.fmh.com /ArcGISWeb/rest/services/Geoprocessing/ORACLE_FMH_CLU_SP11_GeoProc/GPServer/PivotBuffer/submitJob?Expression=TRANS_ID%3D%273fc22379-ac83-47f2-aa2a-77a74d867a64%27&env%3AoutSR=&env%3AprocessSR=&f=htm


We used a URL decoder from web and then just tried decoding the above two to find whether they match with we sent. They look like these after decoding.

1) The url sent from silverlight code (The non working request)

gis.dev.fmh.com /ArcGISWeb/rest/services/Geoprocessing/ORACLE_FMH_CLU_SP11_GeoProc/GPServer/PivotBuffer/submitJob?Expression=TRANS_ID=\u00273fc22379-ac83-47f2-aa2a-77a74d867a64\u0027&f=json&

2) The url submitted from browser(The working request)

gis.dev.fmh.com /ArcGISWeb/rest/services/Geoprocessing/ORACLE_FMH_CLU_SP11_GeoProc/GPServer/PivotBuffer/submitJob?Expression=TRANS_ID='3fc22379-ac83-47f2-aa2a-77a74d867a64'&env:outSR=&env:processSR=&f=htm


The thing we note after we observed the decoded one that fails, is we see a \u0027 added after TRANSID=
It shows that our single quote ' in silveright gets encoded to \u0027 after we sumit to the geoprocessorTask.SubmitJobAsync(parameters);

Can you guess what's happening here. We could not figure out this.

Here is the URL decoding site we found which helped to decode our URLS

http://meyerweb.com/eric/tools/dencoder/

Here is the link to Url encoding symbols

http://www.w3schools.com/TAGS/ref_urlencode.asp

Note: %3D is an = (equal sign)
         %27 is a  '  (single quote)

Thanks
Muralidhar Moka
0 Kudos
DominiqueBroux
Esri Frequent Contributor
After further investigations, it seems it's a bug in the encoding of the string parameters which has been fixed in 2.2.

Could you try with the 2.2 beta for checking that it's really fixed?
0 Kudos
MuralidharMoka
Emerging Contributor
Installing beta 2.2 fixed the Geoprocessing problem.
Thank you very much once again.

Regards,
Muralidhar Moka
0 Kudos