webservice的搭建

关于webservice客户端的搭建:

一:先导入三个jar包:

<dependency>

    <groupId>org.apache.cxf</groupId>

    <artifactId>cxf-rt-frontend-jaxws</artifactId>

    <version>3.2.7</version>

</dependency>

<dependency>

    <groupId>org.apache.cxf</groupId>

    <artifactId>cxf-rt-transports-http</artifactId>

    <version>3.2.7</version>

</dependency>

 

<dependency>

    <groupId>org.apache.cxf</groupId>

    <artifactId>cxf-rt-transports-http-jetty</artifactId>

    <version>3.2.7</version>

</dependency>

 

二:构建程序

  JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();

Client client = clientFactory.createClient("http://114.215.157.224:8086/mds/services/DataService?wsdl");//服务端地址

Object[] result = client.invoke("uploadAllData", xmlString);//方法名和传进去的参数

System.out.println(result[0]);//输出返回参数

posted @ 2019-03-15 16:38  探山  阅读(188)  评论(0编辑  收藏  举报