web services lab 223 林哲价 zoo771121@hotmail.com 葉曉霈 leafy26@hotmail.com 1

Post on 12-Jan-2016

226 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

WEB SERVICESLab 223

林哲价 zoo771121@hotmail.com

葉曉霈 leafy26@hotmail.com

1

OUTLINE

5/30 Web service HTTP

6/6 Apache (server) MySQL (database) PHP HTML5

2

WHY WEB SERVICES?

Interoperability has Highest Priority

Web Services take Web-applications to the Next Level

Web Services have Two Types of Uses Reusable application-components Connect existing software

3

WHAT ARE WEB SERVICES? Web services are application components

Web services communicate using open protocols

Web services are self-contained and self-describing

Web services can be discovered using UDDI

Web services can be used by other applications

XML+HTTP is the basis for Web services4

THE DIFFERENCE BETWEEN XML AND HTML

XML is not a replacement for HTML.

XML and HTML were designed with different goals: XML was designed to transport and store data,

with focus on what data is HTML was designed to display data, with focus

on how data looks

HTML is about displaying information, while XML is about carrying information.

5

WHAT IS XML ? XML stands for EXtensible Markup Language

XML is a markup language much like HTML

XML was designed to carry data, not to display data

XML tags are not predefined. You must define your own tags

XML is designed to be self-descriptive

XML is a W3C Recommendation 6

WEB SERVICES ARCHITECTURE (1)

7

WEB SERVICES ARCHITECTURE (2)

Web Services have three basic platform elements: SOAP WSDL UDDI

8

SOAP(SIMPLE OBJECT ACCESS PROTOCOL)

SOAP TOOLS : Microsoft soaptoolkit30

9

WHAT IS SOAP(SIMPLE OBJECT ACCESS PROTOCOL)?

SOAP is an XML-based protocol to let applications exchange information over HTTP.

Or more simple: SOAP is a protocol for accessing a Web Service. SOAP stands for Simple Object Access Protocol SOAP is a communication protocol SOAP is a format for sending messages SOAP is designed to communicate via Internet SOAP is platform independent SOAP is language independent SOAP is based on XML SOAP is simple and extensible SOAP allows you to get around firewalls SOAP is a W3C standard 10

WSDL(WEB SERVICES DESCRIPTION LANGUAGE)

• 附檔名為 .WSDL, 主要的用途是”描述 Web Service”• 使用共同的標準 , 以便和各種用戶端應用程式相互整合 , 由 IBM 和 Microsoft 共同 研擬

● ( Type ) : 定義各 Element 實際對應之資料型態。● ( Message ) : 定義各輸入、輸出 Message 由哪些參數 Element 所組成。● ( PortType ) : 此 Service 所有 Ports 提供之全部 Operations 的集合。● ( Binding ) : 定義 Binding 所使用的通訊協定,以及提供之 Operations 。

●<service> : 此 WSDL 文件所要描述的 Web Service 集合。 ●<port> : 每一個 Port 代表外界 Client 可以和此 Service 溝通的一個進入點,一個 Port 會指定一個Binding 的方式。

11

WHAT IS WSDL(WEB SERVICES DESCRIPTION LANGUAGE)?

WSDL is an XML-based language for locating and describing Web services. WSDL stands for Web Services Description

Language WSDL is based on XML WSDL is used to describe Web services WSDL is used to locate Web services WSDL is a W3C standard

12

UDDI(UNIVERSAL DESCRIPTION, DISCOVERY, AND INTEGRATION)

13

WHAT IS UDDI(UNIVERSAL DESCRIPTION, DISCOVERY, AND INTEGRATION)?

UDDI is a directory service where companies can register and search for Web services. UDDI stands for Universal Description, Discovery

and Integration UDDI is a directory for storing information about

web services UDDI is a directory of web service interfaces

described by WSDL UDDI communicates via SOAP UDDI is built into the Microsoft .NET platform

14

DISCOVER SERVICE (1) --- WEB SERVICE EXPLORER

15

DISCOVER SERVICE (2) ---FROM INTERNET

http://www.xmethods.net/ve2/index.po

16

EX.1-1

Goal : query the price of products

the product ID

17

EX.1-2

Client 端程式

18

EX.1-3

回傳結果

19

EX.2-1

Goal: find the web services by web service

20

EX.2-2

21

EX.3

一 : 公司或個人的資訊查詢提供Zip Code Information 查詢美國的郵遞區號Delayed Stock Quote 查詢延遲 20 秒的即時股價Barnes and Noble Price Quote 書本的 ISBN 跟價格查詢California Traffic Conditions 即時的美國高速公路交通狀況

二 : 資料檔案的分散存取及服務XMethods Filesystem 提供 1M 的檔案自由存取空間FTP Service FTP 服務SMTP Server Mail 的 SMTP 服務

三 : 數據遠端分散運算Currency Exchange Rate 兩種匯率的換算MillionaireQuiz 心理測驗 –你是百萬富翁嗎 ? ( 支援行動電話 )

LogFileParser 遠端分析你的 IIS 伺服器的 log 檔 22

CREATING A NETWORK APP Write programs that

Run on (different) end systems

Communicate over network

e.g., web server software communicates with browser software

No need to write software for network-core devices Network-core devices

do not run user applications

Applications on end systems allows for rapid app development, propagation

23

CLIENT-SERVER ARCHITECTURE

server Always-on host Permanent IP address Server farms for scaling

clients Communicate with

server May be intermittently

connected May have dynamic IP

addresses Do not communicate

directly with each other24

NETWORK APPLICATION

Some network apps E-mail Web Instant messaging Remote login P2P file sharing Multi-user network games Streaming stored video clips Voice over IP Real-time video conferencing Grid computing Cloud computing 25

APP-LAYER PROTOCOL DEFINES Types of messages

exchanged, e.g., request, response

Message syntax what fields in

messages & how fields are delineated

Message semantics meaning of

information in fields Rules for when and

how processes send & respond to messages

Public-domain protocols defined in RFCs allows for

interoperability e.g., HTTP, SMTP

Proprietary protocols e.g., Skype

26

WHAT TRANSPORT SERVICE DOES AN APP NEED? Data loss

some apps (e.g., audio) can tolerate some loss

other apps (e.g., file transfer, telnet) require 100% reliable data transfer

Timing some apps (e.g.,

Internet telephony, interactive games) require low delay to be “effective”

Throughput some apps (e.g.,

multimedia) require minimum amount of throughput to be “effective”

other apps (“elastic apps”) make use of whatever throughput they get

Security Encryption, data

integrity, …27

WEB AND HTTP

Web page consists of objects Object can be HTML file, JPEG image, Java

applet, audio file,… Web page consists of base HTML-file which

includes several referenced objects Each object is addressable by a URL Example URL:

http://www.ccu.edu.tw/layer2/user_current_student.php

28

HTTP OVERVIEW

HTTP: hypertext transfer protocol Web’s application layer

protocol client/server model Client

browser that requests, receives, “displays” Web objects

Server Web server sends objects

in response to requests

29

HTTP OVERVIEW (CONTINUED)

Uses TCP client initiates TCP

connection (creates socket) to server, port 80

server accepts TCP connection from client

HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)

TCP connection closed

HTTP is “stateless” server maintains no

information about past client requests

30

HTTP REQUEST MESSAGE

Two types of HTTP messages: request, response

HTTP request message: ASCII (human-readable format)

31

HTTP REQUEST MESSAGE: GENERAL FORMAT

32

UPLOADING FORM INPUT

URL method Uses GET method Input is uploaded in URL field of request line: http://translate.google.com.tw/?hl=zh-

TW&tab=wT#

Post method Web page often includes form input Input is uploaded to server in entity body

33

METHOD TYPES

HTTP/1.0 GET POST HEAD

asks server to leave requested object out of response

HTTP/1.1 GET, POST, HEAD PUT

uploads file in entity body to path specified in URL field

DELETE deletes file specified

in the URLfield TRACE CONNECT OPTIONS

34

HTTP RESPONSE MESSAGE

35

HTTP RESPONSE STATUS CODES

In first line in server->client response message.

A few sample codes: 200 OK

request succeeded, requested object later in this message

301 Moved Permanently requested object moved, new location specified later in

this message (Location:) 400 Bad Request

request message not understood by server 404 Not Found

requested document not found on this server 505 HTTP Version Not Supported

36

實驗 實驗步驟 50% 問題討論 40% 心得感想 10%

37

HTML

What is HTML? HTML is a language for

describing web pages. HTML stands for Hyper

Text Markup Language HTML is not a

programming language, it is a markup language

A markup language is a set of markup tags

HTML uses markup tags to describe web pages

HTML Tags HTML tags are

keywords surrounded by angle brackets like <html>

HTML tags normally come in pairs like <b> and </b>

The first tag in a pair is the start tag, the second tag is the end tag

38

HTML Documents = Web Pages HTML documents describe web pages HTML documents contain HTML tags and plain text HTML documents are also called web pages

HTML document 格式<HTML> <HEAD> <TITLE>WebServer</TITLE> </HEAD> <BODY> 您所要在瀏覽器顯示的內容</BODY> </HTML> 39

JAVASCRIPT

What is JavaScript? JavaScript was designed to add interactivity to

HTML pages JavaScript is a scripting language A scripting language is a lightweight

programming language JavaScript is usually embedded directly into

HTML pages JavaScript is an interpreted language (means

that scripts execute without preliminary compilation)

Everyone can use JavaScript without purchasing a license 40

JAVASCRIPT 和 JAVA 的基本分別

JavaScript Java

編寫在 HTML 檔內 不能編寫在 HTML 檔瀏覽器在開啟 HTML 檔時會直譯 (Interpret) JavaScript , 之後就

可執行編寫的程式需要編譯 (Complie) 做 Java byte-code 才可執行

不能讀寫檔案, 最多只能運用 Cookie 技術儲存少許資料在瀏覽

器可以讀寫檔案

不能控制網絡 可以控制網絡

JavaScript 的發展目的在於提高網頁的互動性, 所以在網頁內容控制方面, JavaScript 算是最方便快捷的。

41

PHP

What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports many databases PHP is an open source software PHP is free to download and use

What is a PHP File? PHP files can contain text, HTML tags and scripts PHP files are returned to the browser as plain

HTML PHP files have a file extension of ".php", ".php3",

or ".phtml"

<?php echo 'Hello World!'; ?>

42

REFERENCE

HTML/CSS/JavaScript http://www.w3schools.com/ PHP http://www.wasite.com/php0/ SQL http://www.1keydata.com/tw/sql/sql.html JavaScript http://taiwantc.com/js/js_tut_intro.htm

43

top related