We are working on developing a REST based WCF service. I was wondering if it is a good idea to always return objects from the service calls irrespective of the execution status.
If any exception would occur on the service side, then appropriate fields in that object would be populated with the exception details (error code & message), otherwise it will just have the error code field set to 0 indicating success. In our case the consumer of the service can be either Java or .NET.
In REST services we model communication, including communicating errors, on the HTTP protocol. For REST services built using WCF 4, use the WebFaultException to return error conditions from a service. This results in returning a response message to the client with the HTTP status indicating the disposition of the request.