Bug: SOAP faults ar...
 
Notifications
Clear all

Bug: SOAP faults are returned with HTTP 422 instead of 500/400, breaking Zimbra-compatible SOAP clients

1 Posts
1 Users
0 Reactions
478 Views
(@mhammett)
Active Member
Joined: 13 years ago
Posts: 19
Topic starter  

Summary

SoapServlet returns every SOAP fault with HTTP status 422 (SC_UNPROCESSABLE_CONTENT; carbonio-mailbox store/src/main/java/com/zimbra/soap/SoapServlet.java, line 360: soapProto.hasFault(envelope) ? SC_UNPROCESSABLE_CONTENT : HttpServletResponse.SC_OK).

The SOAP 1.2 HTTP binding (W3C SOAP 1.2 Part 2, section 7.4.1.2.1) specifies 500 for faults with an env:Receiver code and 400 for env:Sender; SOAP 1.1 uses 500 for all faults. Zimbra returns 500, so SOAP clients built against that behaviour (Zimbra Desktop, the zclient / SoapHttpTransport client in zm-common, scripts) only parse the fault body on 500 and treat 422 as a transport error. The real fault code is lost: a wrong password surfaces as "HTTP 422 Unprocessable Entity" instead of account.AUTH_FAILED, mail.NO_SUCH_MSG is not recognised, and client fallbacks keyed on fault codes never run.

Steps to reproduce

curl -s -o /dev/null -w '%{http_code}\n' -H 'Content-Type: application/soap+xml' \
  --data '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><AuthRequest xmlns="urn:zimbraAccount"><account by="name">user@example.com</account><password>wrong</password></AuthRequest></soap:Body></soap:Envelope>' \
   https://<carbonio-host>/service/soap/ 

Expected: 500 (env:Receiver) or 400 (env:Sender, as here), with the fault in the body, as in Zimbra and the SOAP 1.2 HTTP binding.
Actual: 422, with the fault in the body.

Environment: Carbonio CE 25.x (4.25.2_ZEXTRAS_202603), Ubuntu 24.04. Found while maintaining a community build of Zimbra Desktop 7.3.1 against Carbonio, which had to add 422 handling to its SOAP transport to read faults at all.

Also filed on GitHub: https://github.com/zextras/carbonio-mailbox/issues/1171



   
Quote