(一)Web service服務端開發java
1. 新建一個Web service project, 菜單New -> Web Service Projecttomcat
2. 新建一個 Class, New -> Classui
public String sayHaha(String suibian){ return "個人小夥伴們," + suibian + ",是否是很神奇啊?"; }
3. 右鍵點擊前面所建的Web service project,新建一個Web service,菜單Newcode
-> Other -> MyEclipse -> Web Services -> Web Serviceip
(二)部署Web service 服務開發
1.添加jar包,部署Tomcat部署
啓動tomcat;get
(三)Web service 客戶端開發class
1. 新建Web project,cli
2. 右鍵單擊前面所建的Web project, 新建Web service client程序,New ->
Other -> MyEclipse -> Web Services -> Web Service Client
3.新建一個Test類,用來調用Hello
public static void main(String[] args) { String suibian = "見證奇蹟時候到啦!"; HelloService hello = new HelloService(); HelloDelegate delegate = hello.getHelloPort(); String fan = delegate.sayHaha(suibian); System.out.println(fan); }
執行輸出!!!