Dodick Zulaimi Sudirman
www.unimedia.ac.id
Lecture 14Introduction to Web Service
Pengantar Teknologi Internet
Introduction to Internet Technology
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
Web Services
• Web Services is a software component stored on one computer that can be accessed via method calls by an application or another computer network
• Web Services protocols and standards are the technology that promote the sharing and distribution of information and business data
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
Why Use Web Services
• Easy to create standards-compliant services• Does not favor any particular computer
language or operating system• Output can be transformed for a wide variety
of uses• It makes a lot of sense for libraries to exploit
the Web Service technique
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
When to use it
• Applications do not have severe restrictions on reliability and speed.
• Two or more organizations need to cooperate– One needs to write an application that uses
another’s service.• Services can be upgraded independently of
clients.– Google can improve PageRank implementation
without telling developer.– Just don’t change the WSDL.
• Services can be easily expressed with simple request/response semantics and simple state.– HTTP and Cookies, for example.
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
Web Services Usage
• Getting stock price information.• Obtaining weather reports.• Making flight reservations.
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
Servlets/CGI VS Web Services
Browser
WebServer
HTTP GET/POST
DB
JDBC
WebServer
DB
JDBC
Browser
WebServer
SOAP
GUIClient
SOAPWSDL
WSDL
WS
DL
WS
DL
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
Web Services Components Relationship
Service Broker
Service ProviderService Requester
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
Web Services Components Relationship
• A service broker, acts as a look up service between a service provider and a service requestor.
• A service provider, publishes its services to the service broker.
• A service requester, asks the service broker where to find a suitable service provider and that binds itself to the provider.
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
Web Services Invocation
gdp.globus.org
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
UDDI
• Universal Description, Discovery, and Integration
• A standard designed to provide a searchable directory of businesses and their Web Services.
• UDDI is designed like a phone book• UDDI business registration consists of three
components:– White Pages — address, contact, and known
identifiers;– Yellow Pages — industrial categorizations based on
standard taxonomies;– Green Pages — technical information about services
exposed by the business.
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
WSDL
• Web Service Description Language.– Describes how the service is to be used– Comparabe to Java Interface.– Guideline for constructing SOAP messages.– WSDL is a document written in XML which
describes a Web service. It specifies the location of the service and the operations (or methods) the service exposes
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
WSDL
>>>from SOAPpy import WSDL
>>>Server=WDSL.Proxy(‘path/to/WSDL’)
>>>server.method.keys()
[u’doGoogleSearch’,u’doGetCachedPage’ …]
>>>callInfo=server.methods[‘doGoogleSearch’]
>>>for arg in callInfo.inparams:
. . . print arg.name, arg.type
key (u’http://www.w3.org/2001/XMLSchema’,u’string’)
. . .
Define expected messages for a service, and their (input or output parameters).
An interface will group together a number of messages (operations)
The network location where the service is implemented , e.g. http://localhost:8080
Bind an Interface via a definition to a specific transport (e.g. HTTP) and messaging (e.g. SOAP) protocol
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
SOAP
• Simple Object Access Protocol– protocols used to perform the data transfer between
functions which is independent of any runtime environment.
– XML Message format between client and service– SOAP is not a transport protocol. You must attach your
message to a transport mechanism like HTTP
• A SOAP message is contained in an envelop.• The envelop element in turn contain (in
order)– An optional header with one or more child entries. – A body element that can contain one or more
child entries. These child entries may contain arbitrary XML data.
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
SOAP
• Headers are really just extension points where you can include elements from other namespaces.
• Body entries are really just placeholders for arbitrary XML from some other namespace.– The body contains the XML
message that you are transmitting.
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
SOAP
<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>...</soap:Header>
<soap:Body>... <soap:Fault> ... </soap:Fault></soap:Body>
</soap:Envelope>
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
Web Service Architecture
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
Web Service Architecture
• Service Discovery:
Part of the architecture which allows us to find Web Services which meet certain requirements. This part is usually handled by UDDI .
• Service Description
Web Services is self-describing. This means that, once you've located a Web Service, you can ask it to 'describe itself' and tell you what operations it supports and how to invoke it. This is handled by the WSDL.
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
Web Service Architecture
• Service Invocation :
Invoking a Web Service involves passing messages between the client and the server. SOAP specifies how we should format requests to the server, and how the server should format its responses.
• Transport :
Finally, all these messages must be transmitted somehow between the server and the client. The protocol of choice for this part of the architecture is HTTP, in theory we could be able to use other protocols.
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
Summary
• Web Services– Web services can convert your applications into web-
applications.– By using XML, messages can be sent between applications
• UDDI– uses WSDL to describe interfaces to web services
• WSDL– WSDL is an XML-based language for describing Web services
and how to access them.– WSDL describes a web service, along with the message
format and protocol details for the web service.
• SOAP– SOAP is a simple XML-based protocol that allows applications
to exchange information over HTTP.– Or more simply: SOAP is a protocol for accessing a web
service.
www.dodick-lecture.co.cc Dodick Zulaimi Sudirman
www.unimedia.ac.id
Reference
Gunzer, Hartwig. 2002.” Introduction to Web Services”. Borland
Garret. 2009. “A short introduction to Web Services”. http://gdp.globus.org/gt3-tutorial/multiplehtml/ch01s02.html akses akhir: 12/10/2010
Sebesta, Robert. 2009.”Programming the World Wide Web”. Pearson
http://onlamp.com/pub/a/onlamp/2007/11/01/the-mojo-of-dojo.html
Dodick Zulaimi Sudirman
www.unimedia.ac.id
Meet You at The Lab
THANK YOU