在springboot中创建webservice服务

最近因为业务的需要,甲方让我在项目中提供webservice接口,然后他推送数据。然后我对甲方的那个技术说,你直接通过http的post访问我们的接口呗,然后他很无辜的用呆萌呆萌的语气和我说,啥post接口啊?接口不都是webservice的吗?再说了在sap中访问接口不就是用webservice吗?直接给我干不会了。我来这个新公司不长时间,因为业务的关系,以前没接触过sap的相关东西,sap是什么我也不知道,后来百度查了一下,我靠,好牛掰的样子,一套要十几万。我想,十几万的产品不能连post请求都办不到吧。算了,你说用webservice就用webservice吧,甲方是爹。

然后,在创建webservice的过程中,遇到了许多的坑,躺了许多雷,为了避免大家采坑,现整理如下。

首先是springboot的pom.xml文件,主要是引入以下依赖

<dependency>
	        <groupId>javax.xml.bind</groupId>
	        <artifactId>jaxb-api</artifactId>
	        <version>2.3.0</version>
	    </dependency>
	    <dependency>
	        <groupId>com.sun.xml.bind</groupId>
	        <artifactId>jaxb-impl</artifactId>
	        <version>2.3.0</version>
	    </dependency>
	    <dependency>
	        <groupId>com.sun.xml.bind</groupId>
	        <artifactId>jaxb-core</artifactId>
	        <version>2.3.0</version>
	    </dependency>
	    <dependency>
	        <groupId>javax.activation</groupId>
	        <artifactId>activation</artifactId>
	        <version>1.1.1</version>
	    </dependency>
<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web-services</artifactId>
		</dependency>

		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
			<version>3.3.1</version>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-transports-http</artifactId>
			<version>3.2.2</version>
		</dependency>
        <dependency>
			<groupId>org.codehaus.woodstox</groupId>
			<artifactId>stax2-api</artifactId>
			<version>4.0.0</version>
		</dependency>
		<dependency>
			<groupId>org.codehaus.woodstox</groupId>
			<artifactId>woodstox-core-asl</artifactId>
			<version>4.4.1</version>
		</dependency>
        <!-- 这个主要是client访问的,但是问题多多-->
		<dependency>
			<groupId>org.apache.axis</groupId>
			<artifactId>axis</artifactId>
			<version>1.4</version>
		</dependency>

		<dependency>
			<groupId>axis</groupId>
			<artifactId>axis-jaxrpc</artifactId>
			<version>1.4</version>
		</dependency>

		<dependency>
			<groupId>commons-discovery</groupId>
			<artifactId>commons-discovery</artifactId>
			<version>0.2</version>
		</dependency>
		<dependency>
			<groupId>wsdl4j</groupId>
			<artifactId>wsdl4j</artifactId>
			<version>1.6.3</version>
		</dependency>

我的jdk环境是jdk11,所以要引入最开始的4个依赖。

还有,springboot的版本不能太高,我原先的版

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值