前言
webservice有两种实现,一种是基于xml的JAX-WS,过来过去都是xml,一种是rest风格的JAX-RS,本文只做两种方式的简单实现,详细资料:参考资料
SpringBoot与JAX-WS
服务端
依赖
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
接口
import javax.jws.WebService;
import java.util.List;
@WebService(targetNamespace = "http://localhost")
public interface UserService {
void saveUser(User user);
void