I am using Apache CXF 4.1.3, the latest version. I have an implementation of a jakarta.xml.ws.Provider<T> interface where my invoke function sometimes needs to return an error.
According to the JavaDoc of Provider.invoke:
@throws WebServiceException If there is an error processing request. The cause of the {@code WebServiceException} may be set to a subclass of {@code ProtocolException} to control the protocol level representation of the exception.
In my case, my protocol used is HTTP, so I implement this in case of any error:
throw new WebServiceException("something went wrong", new HttpException(123))
to test whether the specific HTTP status code 123 (an example!) is actually used. It's not.
No matter what I do, the HTTP status code is always 500.
How can I persuade this interface to function as documented?