使用CXF时从java代码设置jax-ws属性faultStackTraceEnabled和exceptionMessageCauseEnabled

时间:2012-03-14 14:38:30

标签: jax-ws cxf

为了帮助解决网络服务问题,我想将faultStackTraceEnabled和exceptionMessageCauseEnabled变为true。

它似乎是一个可以在配置XML https://cxf.apache.org/docs/jax-ws-configuration.html中定义的端点设置。唯一的问题是没有配置xml。客户端是使用CXF版本2.5.2 wsdl2java创建的。配置似乎只是注释。

尝试了一些代码来获取终点并设置属性,但它不起作用。

        UserManagementService ss = new UserManagementService();
        UserManagementServiceV10 port = ss.getUserManagementServiceV10();  

        org.apache.cxf.endpoint.Client client =
                org.apache.cxf.frontend.ClientProxy.getClient(port);
        org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
        EndpointInfo endPointInfo = cxfEndpoint.getEndpointInfo();
        endPointInfo.setProperty("faultStackTraceEnabled", "true");
        endPointInfo.setProperty("exceptionMessageCauseEnabled", "true");

1 个答案:

答案 0 :(得分:0)

这些设置仅供服务器端告知服务器返回故障跟踪并返回客户端。它们不会对客户端产生任何影响。我不确定你想要完成什么。