tosi
tosi

Reputation: 1925

Apache CXF Out Interceptor change fault Response

How would I be able to handle a soap fault in cxf out interceptor but changing the response from fault to success response, I am also using ws-addressing and WSS4J as part of the response.

I am struggling to return a

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
       ws-address- ws-security
<soap:Body>
          <Response>
            Ok!
          </Response>
       </soap:Body>
    </soap:Envelope>

rather I am currently getting

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
   <soap:Body>
      <soap:Fault>
         <soap:Code>
            <soap:Value>soap:Receiver</soap:Value>
         </soap:Code>
         <soap:Reason>
            <soap:Text xml:lang="en">Fault occurred while processing.</soap:Text>
         </soap:Reason>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

Upvotes: 1

Views: 2211

Answers (1)

soilworker
soilworker

Reputation: 1337

The documentation(http://cxf.apache.org/docs/interceptors.html) says: Additionally, in the case of SOAPFaults, a CXF web service will create a separate outbound error handling chain and the client will create an inbound error handling chain.

So I think you have to add a InFaultInterceptor/OutFaultInterceptor where you can handle your response message.

Upvotes: 1

Related Questions