Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

In the documentation for using handler functions with ArcGIS Server Rest SOE's, they don't explain how the keys in the boundVariables collection are determined. When I search through the entire solution for "customLayersID" I don't see anything. How would I know to use "customLayersID" as a key?

private byte[] CustomLayer(NameValueCollection boundVariables, string outputFormat,
    string requestProperties, out string responseProperties)
{
    responseProperties = null;

    //The LayerID.
    int layerID = Convert.ToInt32(boundVariables["customLayersID"]);

    //Execute.
    CustomLayerInfo layerInfo = GetLayerInfo(layerID);

    string json = layerInfo.ToJsonObject().ToJson();

    return Encoding.UTF8.GetBytes(json);
}
share|improve this question

1 Answer 1

up vote 5 down vote accepted

The bound variable key takes the form of the resource name + "ID".

This is not very clearly stated in the conceptual document you linked to, but I remember seeing it somewhere.

EDIT: See this PDF, slide number 45. Resources seem to be always identified by their identifier (id), which is ok, but I personally find this string-convention-based design very weird. I should also note that the slides are a little outdated and do not exactly match the shipped version of the API.

One last (pedantic) complaint - ESRI will apparently never learn that id is not an abbreviation and as such should not be spelled in uppercase :-)

share|improve this answer
    
Thanks petr k.! –  Kirk Kuykendall Nov 1 '10 at 21:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.