If your SOE is in .NET you will have to construct the jsonified string yourself.
Essentially it would be:
responseProperties = "{
\"Content-Type\" : \"image/png\",
\"X-HTTP-Status\" : \"500 - An error occurred while generating the image.\"
}";
Thanks Rahul.X-HTTP-Status is not a standard header to my understanding. It should be an experimental header and do you mean the client should be able to interpret this header?I tried to create a sample operation that constructs the response properties in the way you suggested but somehow I am not able to make it work.
RestOperation findNearFeatsOp = new RestOperation("GetImage",
new string[0] ,
new string[] { "img" },
GetImage);
..................
private byte[] GetImage(System.Collections.Specialized.NameValueCollection boundVariables,
ESRI.ArcGIS.SOESupport.JsonObject operationInput,
string outputFormat,
string requestProperties,
out string responseProperties)
{
responseProperties = "{\"Content-Type\" : \"image/png\",\"X-HTTP-Status\" : \"404 - Could not find the image requested.\"}";
return null;
}
Once error is encountered, I add X-HTTP-Status header and return null. I returned because I have nothing to return to the client. I guess that particular return null statement is causing the problem. I am confused what to return in such case. In case of json error, we just wrap the error in json and send the json string as bytes.