Skip to content

CXF 调用 WebService 日志

Published: at 00:00

CXF 调用 WebService 日志

import
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
code
	JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
    Client client = clientFactory.createClient(url);
    client.getInInterceptors().add(new LoggingInInterceptor());
    client.getOutInterceptors().add(new LoggingOutInterceptor());
    try {
        Object[] result = client.invoke("run", params);
        System.out.println("返回结果:" + result[0]);
    } catch (Exception e) {
        System.out.println("异常信息:" + e.getMessage());
    }