Maven搭建CXF远程服务调用小项目

本文档介绍了如何使用Maven构建一个CXF服务端项目,并通过CXF提供远程服务。首先创建服务端war包,然后生成web.xml并引入所需依赖。接着配置web.xml和spring文件,定义服务接口和实现类。服务发布后,通过指定URL访问。此外,还详细讲解了客户端的搭建过程,包括配置pom.xml,使用wsimport生成客户端代码,编写Spring配置文件和测试类,最终成功调用远程服务。
摘要由CSDN通过智能技术生成

1.创建服务端:war包

2.右击项目,选择J2EE Tools,生成web.xml文件.

3.引入依赖

  <dependencies>
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-frontend-jaxws</artifactId>
    <version>3.2.3</version>
</dependency>

  <!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-transports-http -->
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-transports-http</artifactId>
    <version>3.2.3</version>
</dependency>

  	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-web</artifactId>
  		<version>4.2.4.RELEASE</version>
  	</dependency>
  </dependencies>
  
  
  <build>
  	<plugins>
    		<plugin>
  			<groupId>org.apache.maven.plugins</groupId>
  			<artifactId>maven-compiler-plugin</artifactId>
  			<version>3.5.1</version>
  			<configuration>
  				<!-- 源码版本 -->
  				<source>1.8</source>
  				<!-- 编译版本 -->
  				<target>1.8</target>
  				<!-- 指定编码 -->
  				<encoding>UTF-8</encoding>
  			</configuration>
  		</plugin>
  		
  		<plugin>
    			<groupId>org.apache.tomcat.maven</groupId>
    			<artifactId>tomcat7-maven-plugin</artifactId>
    			<version>2.2</version>
    			<configuration>
    				<port>8080</port>
    				<!-- 项目访问路径 -->
    				<path>/weather</path>
    				<!-- 解决传输数据乱码 -->
    				<uriEncoding>utf-8</uriEncoding>
    			</configuration>
    		</p
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值