欢迎转载,出处http://www.cnblogs.com/shizhongtao/p/3433679.html
利用cxf的框架实现
import javax.xml.namespace.QName; import org.apache.cxf.endpoint.Client; import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(); Client client = factory.createClient(wsdlUrl); try { Object[] res= client.invoke(new QName(namespaceURI, localPart), xml); // System.out.println(res[0]); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }
其实和上一篇差不多。只是cxf对其进行了封装。