Select to view content in your preferred language

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

2065
1
07-12-2010 08:20 AM
PrashantKhanal
Emerging Contributor
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.
0 Kudos
1 Reply
PrashantKhanal
Emerging Contributor
The problem does not exist anymore in the released version. I was working on pre released version.
0 Kudos