2. Function
Function คือ โปรแกรมย่อยชนิดหนึง ซึงอาจจะมีการรับค่ามาจาก
โปรแกรมหลักทีเรี ยกใช้ Function นันๆ จากนันจะมีการประมวลผลคําสังใน
( (
Function พร้ อมกับจะมีการคืนค่ากลับไปทีโปรแกรมหลักทีเรี ยกใช้ งาน
Function นันๆ
( Main Program 1
…
Function Call function cal(2)
Function cal (number As Integer) importing result.
Dim result As Integer write result.
result = number ** 2 …
return result Main Program 2
End Function …
Call function cal(4)
importing result.
write result.
…
4. Web Application ยุคที& 1 : Static Web Page
http://www.prapoj.com/current.html
HTTP request
HTTP response
Web Browser Web Server
Web Pages
5. Web Application ยุคที& 2 : Dynamic Web Page
.asp,.jsp,.php,.pl…
http://www.prapoj.com/index.asp
HTTP request
SQL Statement
HTTP response
Web Server
Web Browser
Data
Web Pages Database
6. Web Application ยุคที& 3 : Web Service Technology
.asp,.php,.pl,jsp
… st Web Service
http://www.prapoj.com/index.aspx er HTT P reque
S OAP ov
Web Server
HTTP request SOA
P ov
HTTP response er H
T TP
Web Server re que
Web Browser st
Web Service
Web Server
12. Web Service?
Application หรื อโปรแกรม(หรื อ Function)ซึงทําหน้ าทีอย่างใด
อย่างหนึงในลักษณะให้ บริการ(Service) โดยจะถูกเรี ยกใช้ งานจาก
Application หรื อโปรแกรมอืนๆผ่านทาง Web (Web Server โดย
อาศัย SOAP Protocol) การให้ บริ การของ Web Service นัน จะมี (
เอกสารทีอธิบายคุณสมบัตของบริ การกํากับไว้ (WSDL) และมีการ
ิ
นําเสนอให้ สาธารณชนรับทราบ(UDDI) ผู้ใช้ บริ การจึงสามารถทีจะ
ค้ นหาบริ การของ Web Service ต่างๆได้ โดยไม่จําเป็ นต้ องรู้ทีอยู่
จริ งของ Application หรื อโปรแกรมทีให้ บริการ Web Service นันๆ (
13. Web Service Definition
Web services are the fundamental building blocks in the move to distributed
computing on the Internet
Open standards and the focus on communication and collaboration among
people and applications have created an environment where XML Web
Service are becoming the platform for application Integration
Applications are constructed using multiple XML Web Services from various
sources that work together regardless of where they reside or how they
were implemented
One of the primary advantages of the XML Web Services architecture is
that it allows programs written in different languages on different platforms
to communicate with each other in a standards-based way
14. Web Service Concept
“Web Services are self-contained, self-describing modular applications that
can be published, discovered and invoked across the Web”
2
WSDL
3 4 SOAP Request
1
WSDL Web Service
SOAP Response
Web Server Component
5
15. ขันตอนในการพัฒนา Web Service
:
สร้ าง Web Service โดยการพัฒนาแบบ Manual หรื อใช้ เครืองมือ
(Tool) ในการ Generate เราจะได้ เอกสาร WSDL บรรยาย
คุณลักษณะของ Web Service นันๆ (
ทําการ Publish ในส่วนของ Web Service ไปที UDDI เพือให้
บุคคลทัวไปสามารถค้ นหา Web Service ทีเราพัฒนาขึ (นมาได้
16. ขันตอนในการเรี ยกใช้ Web Service
:
ค้ นหาบริ การ Web Service ผ่าน UDDI ซึงทําให้ เราได้ ข้อมูล
เกียวกับประเภทบริ การ ทีตังของบริการ และเอกสาร WSDL
(
บรรยายคุณลักษณะของบริการนันๆ (
ติดต่อขอใช้ บริ การ Web Service โดยใช้ SOAP Protocol (SOAP
Request)ด้ วยการเขียนโปรแกรมขึ (นมาเรี ยกใช้ Method ของ Web
Service นันๆโดยอาศัยข้ อมูลทีอยูในเอกสาร WSDL
( ่
ผู้ให้ บริ การส่งผลลัพธ์กลับมาในรูปของ XML(SOAP Response)
17. Standards Behind Web services
Simple Object Access Protocol (SOAP) is based on XML and
Hypertext Transport Protocol. It provides a way for applications —
including those running on different operating systems — to
communicate and work together through remote procedure calls
implemented via HTTP
Universal Description, Discovery and Integration (UDDI) describes
how to publish and discover information about Web services
applications. It is a Web-based directory where someone can search
for particular Web services and what they do
18. Standards Behind Web services
Web Services Description Language (WSDL), based on XML,
describes the kinds of software applications, or services, available
on a particular network. Once someone develops a Web service,
they can publish its description and link in a special UDDI repository.
When someone wants to use the service, they request the WSDL file
so they can determine its location, function calls and how to get to
them. They use that information to construct a SOAP request to a
server
eXtensible Markup Language is a streamlined version of Standard
Generalized Markup Language, developed by the International
Organization for Standardization to define the structures of different
types of electronic documents. XML can be used to store any kind of
structured language and encapsulate data so it can be shared
between otherwise incompatible computer systems
19. Web Service Components
Web Service = WSDL + UDDI + SOAP
UDDI
UDDI Business Registry
h
S earc
Publish
Consume Web
Service
WSDL
SOAP
20. WSDL
Web Service Description Language เป็ นภาษาทีใช้ อธิบาย
คุณลักษณะของ Web Service และวิธีในการติดต่อกับ Web Service
โดยใช้ ไวยากรณ์ของภาษา XML
21. WSDL
WSDL can be used to describe several primary qualities of a Web Service
message: 1
The address Location of WSDL
The Web Service name 2
The Operation(Function/Method) name 3
The Input/Output parameters
4
The type of data being sent between client and server during a Web Service
message exchange
5
22. WSDL
WSDL is used to describe
Web Services, client and users of
Web Services will use the service
descriptions in WSDL to create client
proxies that access the service of
the provider
The provider defines the operations,
the binding, and the endpoints all in
the WSDL document
23. WSDL
WSDL stands for Web Services
Description Language.
WSDL is a document written in XML.
The document describes a Web
service. It specifies the location of
the service and the operations (or
methods) the service exposes.
25. WSDL Ports
The <portType> element is the most important WSDL
element.
It describes a web service, the operations that can be
performed, and the messages that are involved.
The <portType> element can be compared to a function
library (or a module, or a class) in a traditional programming
language.
WSDL Messages
The <message> element defines the data elements of an
operation.
Each message can consist of one or more parts. The parts can be
compared to the parameters of a function call in a traditional
programming language.
27. WSDL Types
The <types> element defines the data type that are used by the
web service.
For maximum platform neutrality, WSDL uses XML Schema
syntax to define data types.
34. Creating Web Service using Tool
VB component
using SOAP toolkit 3.0 to Generate Web Service
Call Web Service from any client (Programs)
Perl
Java
35. Creating COM Component using VB
VB component MyAddProj.vbp
Public Function Add(ByVal Num1 as Integer,ByVal Num2 as Integer) As Integer
Add = Num1 + Num2
End Function
Generate component -> MyAdd.dll
Register
component
36. Generate Web Service from COM Component
Using SOAP Toolkit From Microsoft
Download at http://msdn.microsoft.com
MyAdd.dll ->
plus2num.wsdl(WSDL file)