从 ServerSOAPFaultException 读取 CXF 异常消息详细信息

reading CXF exception message detail from ServerSOAPFaultException

我已经使用 cxf-codegen-plugin 生成了一个网络服务。 我总是得到 ServerSOAPFaultException 消息 check the server log to find more detail.

而不是获取返回的异常详细信息

我知道我正在调用的网络服务正在返回详细的错误信息,但似乎无法访问。

我正在使用spring-boot

如何阅读完整的错误信息?

我在spring启动时调用生成的代码如下。

public LogonResponse loginLoadBearerToken(LogonRequest lr) throws LogonFault {
    try {
        SecurityService_Service factory = createSecurityService();
        SecurityService securityService = factory.getSecurityServiceSoap11();
        BindingProvider bp = (BindingProvider) securityService;
        String url = String.format("%s/SecurityService-v4_x/securityService/", clientUrl);
        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);

        LogonResponse response = securityService.logon(lr);
        return response;
    } catch (Exception ex) {
        // THIS IS ALWAYS A ServerClientSOAPException
        logger.error("login error connecting to ... {}", ex.getMessage());
        throw ex;
    }
}

简单的解决方案...添加必要的依赖项。

<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-frontend-jaxws</artifactId>
    <version>${cxf.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-transports-http</artifactId>
    <version>${cxf.version}</version>
</dependency>