TestClient.java 753 B

1234567891011121314151617181920
  1. package camel.demo.api7.processor;
  2. import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
  3. /**
  4. * @author HZY
  5. * @vsrsion 1.0
  6. * Created at 2017/4/20.
  7. */
  8. public class TestClient {
  9. public static void main(String args[]) throws Exception{
  10. JaxWsDynamicClientFactory dcf =JaxWsDynamicClientFactory.newInstance();
  11. org.apache.cxf.endpoint.Client client =dcf.createClient("http://192.168.131.101:3333/soap/ws?wsdl");
  12. //getUser 为接口中定义的方法名称 张三为传递的参数 返回一个Object数组
  13. Object[] objects=client.invoke("test");
  14. //输出调用结果
  15. System.out.println("*****"+objects[0].toString());
  16. }
  17. }