在這篇文章,我向java程式開發人員介紹service-oriented architecture (SOA),我將解釋怎麼使用J2EE 1.4去建立一個web 服務使其能操作和方便的通過J2EE1.4來適應應用服務(例如: Oracle Application Server)。
Web Services Architecture
讓我們在學習web services部署J2EE platform之前,我們先瞭解web service 的主要結構。
通過網路我們可以找到一些關於 web services的定義、發布、和調用。一個web service,如圖一
圖一
現在有兩種web services:“RPC style and document style”,RPC-style web services是在最初受歡迎的。但在近幾年是document-style是首選的web services。
RPC-style web services是遠程程式調用,代表相互互動。RPC-style web services在互動資訊中調用和返回必須先符合明確的簽名,在應用中非常不方便。相反,document-style web services 通過用xml,來改變發送和接收應用。
許多的開發人員覺得web services是一個有活力的技術,他繼承SOA。因為它提供一個相互作用在不同的平台和輕便的技術。例如xml,soap,and http。
What Are Web Services Made of?
在web service首先要先定義A Web Services Definition Language (WSDL; pronounced "wizdle") 文檔。
這個WSDL提供一個完全的描述web service,包括連接埠、操作、資訊類型等。
Here is a simple example of a WSDL document that describes a HelloWorld web service:
<definitions
name="HelloService"
targetNamespace="http://oracle.j2ee.ws/ejb/Hello"