webService学习(一)—— hello world
来源:互联网 发布:冬不拉教程软件 编辑:程序博客网 时间:2024/06/05 17:07
webService学习(一)—— hello world
下面介绍一个简答的webService,同时包含调用过程。
1、首先新建一个项目:
修改代码:
package com.xueyoucto.xueyou;import javax.jws.WebService;import javax.xml.ws.Endpoint;/** * Created by Administrator on 2017/1/14. */@WebServicepublic class HelloService { public String testService(String params){ return "hello " + params; } public static void main(String[] args) { Endpoint.publish("http://localhost:8888/HelloService/",new HelloService()); System.out.println("ok"); }}
2、运行项目,运行后控制台输出:
3、查看webservice状态:
3、新建一个项目,然后把webService以接口和配置文件的方式导入到项目中:
4、查看项目中新增的内容:
5、编写程序调用webService(这里采用直接接口调用的方式)
package com.tt;import com.otherWebService.HelloService;import com.otherWebService.HelloServiceService;/** * Hello world! * */public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); HelloService helloService = new HelloServiceService().getHelloServicePort(); String s = helloService.testService("aabbcc"); System.out.println(s); }}
6、运行结果:
7、注意,在重复进行webService的运行时,会出现端口占中,这时可以使用如下命令:
netstat -ano | findstr "8888"
在任务管理器中根据PID进行进程的终止。
0 0
- webService学习(一)—— hello world
- Flex学习笔记(一)——Hello World
- iOS开发学习笔记(一)——Hello,World!
- RabbitMQ学习小结(一)—— Hello World [Python]
- Python学习笔记(一)——Hello World
- 学习 Perl(一) —— 安装及 hello world
- LaTeX学习笔记(一)—Hello World!
- WebService学习笔记-Hello world
- BootStrap学习—01(Hello World)
- WebService(一)Hello world!和IIS配置
- [每日一学]MFC学习笔记——Hello World
- Python学习笔记(一)Hello World
- maven学习笔记(一)hello world
- springMVC学习笔记一(hello world)
- BeeFramework学习(一):Hello World
- maven学习(一)--Hello World
- jquery学习(一)hello world
- React学习(一)Hello world
- Kibana using lots memory
- 尚硅谷java学习笔记——8.java泛型(Generic)
- Linux下配置jdk环境变量
- 从Zachman企业架构框架想到的
- 面试题c++
- webService学习(一)—— hello world
- BUPT OJ 中序遍历序列
- dp总结
- 高可用性系统的实践与经验
- Plplot绘制简单2D函数图
- C++实现UMG中自定义不规则形状按钮
- CSS开发基础——CSS盒子模型
- 《利用条件随机场实现中文病历文本中时间关系的自动提取》——阅读笔记
- solr支持jsonp