整个项目的目录结构是

Mycontroller.java:可以在localhost:8080/hello中查看
 //Mycontroller.java

 package com.chenyun.controller;

 import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; @RestController
public class Mycontroller { @RequestMapping("/hello")
public String sayname(){
return "hello";
}
}

WsImpl.java:

//WsImpl.java

package com.chenyun.impl;

import com.chenyun.service.Ws;

import javax.jws.WebService;

@WebService
public class WsImpl implements Ws {
public String sayname(String name){
return "name is" + name;
} public String sayname2(String name){
return "name is" + name;
}
}

Ws.java

 //Ws.java

 package com.chenyun.service;

 import javax.jws.WebService;

 @WebService
public interface Ws {
String sayname(String name);
String sayname2(String name);
}
WebserviceServerFinalApplication.java
 //WebserviceServerFinalApplication.java

 package com.chenyun;

 import com.chenyun.impl.WsImpl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import javax.xml.ws.Endpoint; @SpringBootApplication
public class WebserviceServerFinalApplication {
public static void main(String[] args) {
SpringApplication.run(WebserviceServerFinalApplication.class, args);
String url = "http://localhost:8081/Webservice";
Endpoint.publish(url,new WsImpl());
System.out.println("=====================================");
System.out.println("发布webservice成功");
System.out.println("=====================================");
}
}

pom.xml

 <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.chenyun</groupId>
<artifactId>webservice_test_v5</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>webservice_test_v5</name>
<description>Demo project for Spring Boot</description> <properties>
<java.version>1.8</java.version>
</properties> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency> <dependency>
<groupId>org.reficio</groupId>
<artifactId>soap-builder</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies> <repositories>
<repository>
<id>reficio</id>
<url>http://repo.reficio.org/maven/</url>
</repository>
</repositories> <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

最新文章

  1. Android的编码规范
  2. 初识Servlet
  3. jsoup获取文档类示例
  4. 启动网卡报:Device eth0 does not seem to be present”解决办法
  5. Eclipse 启动出现错误 no java virtual machine was found
  6. LeetCode() Binary Tree Level Order Traversal
  7. mvc模型验证
  8. c#查找string数组的某一个值的索引
  9. 第1章 认识jQuery
  10. 【leetcode❤python】 160. Intersection of Two Linked Lists
  11. oracle 未找到提供程序。该程序可能未正确安装
  12. C#设计模式(16)——迭代器模式(Iterator Pattern)
  13. linux下socket编程
  14. boost.compressed_pair源码剖析
  15. Apache服务器访问过慢分析及解决
  16. CoreOS Linux available in China
  17. Flume NG中的ElasticSearch Sink
  18. 互联网TCP/IP五层模型(一)
  19. python非转基因HTTP请求库--Requests: 让 HTTP 服务人类
  20. Akka(8): 分布式运算:Remoting-远程查找式

热门文章

  1. jQuery系列(四):jQuery的属性操作
  2. codeforces708C
  3. vscode 遇到 TabError: inconsistent use of tabs and spaces in indentation
  4. RHSA-2018:0014-重要: linux-firmware 安全更新
  5. Spring事件监听ApplicationListener源码流程分析
  6. LeetCode 131. 分割回文串(Palindrome Partitioning)
  7. spring boot 全局异常处理及自定义异常类
  8. 如何应对POST方式下载文件的接口
  9. 在CentOS7阿里云服务器部署ThinkPHP5,并配置phpstrom实现同步开发(微信小程序及管理员后端)
  10. handler定义