JaxWsProxyFactoryBean 创建WebService客户端

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
public class WSClientUtil {
    
    /**
     * get web service proxy client
     * @param serviceClass
     * @param address
     * @return
     */
    @SuppressWarnings("unchecked")
    public static  T getWSClient(Class serviceClass, String address) {
        JaxWsProxyFactoryBean proxyBean = new JaxWsProxyFactoryBean();
        proxyBean.setServiceClass(serviceClass);
        proxyBean.setAddress(address);
        Object proxy = proxyBean.create();
        // WSSecurityClient.setSecurity(proxy);
        return (T) proxy;
    }
}

 

转载于:https://www.cnblogs.com/liushengit/p/8599045.html

你可能感兴趣的:(java)