user219882
user219882

Reputation: 15844

How to return SOAPFault to the client from the Filter?

I have the code below and I need to return SOAP response (correct XML). If I throw new SoapException(...), it will return HTML page which is wrong. Thanks in advance for all advises.

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
...

    if (!checkMsg()) {
        // return SOAP response
    }

...
}

Upvotes: 0

Views: 838

Answers (1)

user219882
user219882

Reputation: 15844

The SOAPException cannot be created in the Filter. I have to throw SerlvetException. If I want to return the SOAPException, I have to chain CXF servlet and throw it there.

Upvotes: 1

Related Questions