webservice-demo
来源:互联网 发布:php ftp上传大文件 编辑:程序博客网 时间:2024/06/05 07:55
•
- package com.ws.jaxws.sayHello.service;
- import javax.jws.WebService;
- import javax.jws.soap.SOAPBinding;
- import javax.jws.soap.SOAPBinding.Style;
- @WebService
- //@SOAPBinding(style=Style.RPC)
- public interface SayHelloService {
- public String sayHello(String name);
- }
- package com.ws.jaxws.sayHello.service.impl;
- import javax.jws.WebService;
- import com.ws.jaxws.sayHello.service.SayHelloService;
- @WebService(endpointInterface = "com.ws.jaxws.sayHello.service.SayHelloService", name = "sayHelloService", targetNamespace = "sayHello")
- public class SayHelloServiceImpl implements SayHelloService {
- @Override
- public String sayHello(String name) {
- // TODO Auto-generated method stub
- if("".equals(name)||name==null){
- name="nobody";
- }
- return "hello "+name;
- }
- }
- package com.ws.jaxws.sayHello.server;
- import javax.xml.ws.Endpoint;
- import com.ws.jaxws.sayHello.service.impl.SayHelloServiceImpl;
- public class SayHelloServer {
- public static void main(String[] args) throws Throwable{
- Endpoint.publish("http://localhost:8888/sayHelloService", new SayHelloServiceImpl());
- System.out.println("SayHelloService is running....");
- Thread.sleep(5 * 60 * 1000);
- System.out.println("time out....");
- System.exit(0);
- }
- }
- package com.ws.jaxws.sayHello.client;
- import java.net.MalformedURLException;
- import java.net.URL;
- import javax.xml.namespace.QName;
- import javax.xml.ws.Service;
- import com.ws.jaxws.sayHello.service.SayHelloService;
- public class SayHelloClient {
- public static void main(String[] args) throws MalformedURLException {
- String url="http://localhost:8888/sayHelloService?wsdl";
- Service service=Service.create(new url), new QName("sayHello","SayHelloServiceImplService")); //获得webservice的信息
- SayHelloService sayHelloService=service.getPort(SayHelloService.class);//return a proxy
- System.out.println(sayHelloService.sayHello(null));//调用服务
- System.out.println(sayHelloService.sayHello("zhangsan"));
- }
- }
0 0
- webService demo
- webservice demo
- webservice demo
- webservice-demo
- .Net WebService Demo
- webservice的demo
- 动态加载WebService DEMO
- ios webservice 登陆 demo
- android 调用webService Demo
- webservice(resteasy demo)
- webservice(xfire demo)
- webservice(cxf demo)
- webservice demo示例
- WebService 入门 Demo
- webService的demo
- webservice 接口测试demo
- 初步接触webservice,以及demo
- php调用 .net webservice demo
- Java内存泄露的理解与解决
- 数据恢复
- ubuntu 14.04简单运行vsftpd
- VC获取硬盘序列号
- 图解TCP-IP协议
- webservice-demo
- 软件智力题
- java快速排序QuickSort的代码和使用(包含清晰完成过程)
- C++ 虚函数表解析
- php验证手机归属地
- solrcloud学习记录
- IT忍者神龟之jquery easyui DataGrid 实例,增、删、查、改基础功能
- ios模拟器键盘不弹出
- 黑马程序员_iOS开发初学者扫盲