簡述Web Service通訊技術的搭建流程

來源:互聯網
上載者:User

標籤:ted   return   url   internet   .com   搭建   通訊   ges   java   

Web Service 基本概念

  Web Service也叫XML Web Service WebService是一種可以接收從Internet或者Intranet上的其它系統中傳遞過來的請求,輕量級的獨立的通訊技術。

是通過SOAP在 Web上提供的軟體服務,使用WSDL檔案進行說明,並通過UDDI進行註冊。

---------------------------------------------------------分割線-----直接示範好了------

一、開啟MyEclipse,建立一個Web
Service項目。

二、輸入項目名Web Service

點Finish建立項目。


 

三、建立一個java類

package
server;

public
class Hello {

public
String sayHello(String name) {
return name + ", hello!";
}
}

四、點src,開啟右鍵,選擇New->Other

五、在MyEclipse下Web
Services下選擇Web
Service

六、點Next,選擇Create
web service from Java class

七、點Next,選擇剛才輸入的類
 

八、點擊Finish

九、添加架包

註:如果不加這兩個架包,tomcat啟動時會報錯誤

然後將項目發布到Tomcat,啟動Tomcat,訪問http://127.0.0.1:8080/Demo/DemoPort

結果如下:


Web
Service製作完成。

九、製作用戶端,開啟嚮導,選擇Web Service Client

十、點Next

十一、點Next,選擇WSDL
URL,然後輸入http://127.0.0.1:8080/Demo/HelloPort?wsdl

Java package輸入client

十二、點Next


十三、點Finish

產生用戶端調用代碼

十四、建立用戶端

package com.soft863.test;

import com.soft863.client.HelloDelegate;
import com.soft863.client.HelloService;

public class Test {
public static void main(String[] args) {

HelloService server = new HelloService();
HelloDelegate helloPort = server.getHelloPort();
String result = helloPort.say("壯壯");
System.out.println(result);

}
}

十五、運行Test

以下是運行結果


說明已經成功建立了關係

 

簡述Web Service通訊技術的搭建流程

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.