import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestMain {
/**
* @param args
*/
public static void main(String[] args) {
String xmlInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><operateType>query</operateType><dbType>sqlserver</dbType><orderBy></orderBy><userId>1</userId><start>0</start><limit>20</limit><processName></processName></request>";
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
String wsUrl = "地址
String method = "findAllUser";//webservice的方法名
Client client = dcf.createClient(wsUrl);
Object[] res = null;
try {
res = client.invoke(method, xmlInput);//调用webservice,cxf客户端调用webservice就是这么简单
} catch (Exception e) {
e.printStackTrace();
}
System.exit(0);
// END SNIPPET: client
}
}