我在处理 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 完全符合逻辑?我不知道如何获取信息(代码和描述)然后......
亲切的问候!