pkhanal

ESRI server throws error while creating an operation that does not take any parameter

Discussion created by pkhanal on Jul 12, 2010
Latest reply on Jul 15, 2010 by pkhanal
I created a REST operation that does not take any parameters as:

RestOperation jsonResultOperation = new RestOperation("JsonResultOperation", new String[0], new string[]{"json"}, JsonResultOperation);

However, the server throws error while requesting this operation from the client.

Does it mean an operation should take at least one input parameter?

Log Entry : 7/12/2010 10:51:01 AM
  ERROR:Array cannot be null.
Parameter name: bytes ::    at System.Text.Encoding.GetString(Byte[] bytes)
   at ESRI.ArcGIS.REST.JsonWriter.PrettifyJson(Int32 indentLvl, Int32 indent, Byte[] jsonBytes)
   at ESRI.ArcGIS.REST.SOE.SOERESTResponseFormatter.WriteResponse()
   at ESRI.ArcGIS.REST.ResponseFormatter.WriteFormattedResponse()
   at ESRI.ArcGIS.REST.RequestHandler.ProcessRequest()
   at ESRI.ArcGIS.REST.RestHttpHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context)

If i add a breakpoint on the implementation of HandleRESTRequest, i never get there. However if i modify the operation to take one parameter as
RestOperation jsonResultOperation = new RestOperation("JsonResultOperation", new String[]{"text"}, new string[]{"json"}, JsonResultOperation);

It works perfectly.

Outcomes