webService

第一步:使用第三方调用WebService

第二步:调用wsimport命令,导入webService

 

 

将导入的文件复制到MyEcliprice项目文件中

使用@WebService注解

package Test;

import javax.jws.WebService;
import javax.xml.ws.Endpoint;
//局域网任何人都可以访问access
@WebService
public class HelloService {
 public void say(String name){
     System.out.println("Hello"+name);
 }
public static void main(String[] args) {
    Endpoint.publish("http://192.168.15.81:50000/hello", new HelloService());
    System.out.println("server is listening...");
}
}

 

新建测试类

package MyTest;

import test.HelloService;
import test.HelloServiceService;



public class mytest {
    public static void main(String[] args) {
        HelloServiceService hs=new HelloServiceService();
        HelloService helloServicePort = hs.getHelloServicePort();
        helloServicePort.say("李泽阳");
    }
}

 

posted @ 2016-12-17 20:58  李泽阳  阅读(162)  评论(0编辑  收藏  举报