When we return a business mistake we should not be able to give body to the answer.
For example, a 404 error is self-sufficient; there is no need to re-specify what led to it (the parameters of the call are already known to the caller).
In this case the HTTP response could be
HTTP/1.1 404 Not Found
Date: Sun, 18 Oct 2012 10:36:20 GMT
Connection: Closed
Currently it is obligatory to provide an answer. If no transformation is provided it is the object to use to throw the error that is used for the response.
With a transformation, an object must be returned, otherwise a technical error is thrown (org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 1; Premature end of fil etc.).
Ideally, there should be a configuration parameter in the fault handling to indicate that you do not want to provide a body for the response.
for example :
<rest:on-fault order-id="0">
<rest:condition>
<rest:xpath>boolean(/*[local-name()='objetc-not-found'])</rest:xpath>
</rest:condition>
<rest:http-response http-code="404">
<rest:transformation>
<rest:no-body>true</rest:no-body>
</rest:transformation>
</rest:http-response>
</rest:on-fault>
or
<rest:on-fault order-id="0">
<rest:condition>
<rest:xpath>boolean(/*[local-name()='objetc-not-found'])</rest:xpath>
</rest:condition>
<rest:http-response http-code="404" no-body="true"/>
</rest:on-fault>
The goal is to have a clear parameter is easily identifiable.
Hooking this parameter on HttpResponse allows to make this behavior on any response and force this behavior independently of the detected type of orperation.