Apache-cxf客户端获取SOAPFaultException而不是自定义异常

时间:2015-07-30 13:52:36

标签: exception cxf cxf-client

我在apache-cxf客户端处理异常时遇到了麻烦。 我期待肥皂调用引发的异常' Fault_Exception'但我总是收到常见的SOAPFaultException

生成的类:

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

    private a.b.c.Fault faultMessage;

    ....

}

和错误

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

...
}

皂:

<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>

生成的类和响应之间是否存在不匹配? 或者还有什么问题呢? 或者,我得到SOAPFaultException是完全逻辑的吗?我不知道如何获取信息(代码和描述)然后......

亲切的问候!

0 个答案:

没有答案
相关问题