5

I'm having troubles with handling Exceptions in my apache-cxf client. I'm expecting an exception that is thrown by the soap call 'Fault_Exception' but I'm always receiving the common SOAPFaultException

Generated classes:

@WebFault(name = "FaultMessage", targetNamespace = "http://a.b.c/ws/")
public class Fault_Exception extends Exception {

    private a.b.c.Fault faultMessage;

    ....

}

and Fault is

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "fault", propOrder = {
    "code",
    "description",
    "stack"
})
public class Fault {

...
}

soap:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>EXCEPTION</faultstring>
         <detail>
            <Fault xmlns:n1="http://a.b.c/ws/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://a.b.c/ws/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="n1:fault">
               <code xmlns="http://a.b.c/ws/">error.code.1</code>
               <description xmlns="http://a.b.c/ws/">some description of the error.</description>
               <stack xmlns="http://a.b.c/ws/">....</stack>
            </Fault>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

Is there a mismatch between the generated classes and the response ? Or what else can be the problem of this? Or is it totally logic that I get a SOAPFaultException? I have no clue how to get the information (code & description) then ...

Kind regards!

user4768018
  • 131
  • 1
  • 3
  • Did you ever resolve this issue ? I am having the very same issue now and would gladly like to know what the solution is. Thanks a million for any help/feedback. – fergal_dd Jun 06 '17 at 11:18
  • you will need to debug and see in which class are you getting the exception and track it – Ujjwal Gulecha Feb 21 '18 at 07:08

0 Answers0