webservicespps3416
Transcript of webservicespps3416
-
8/2/2019 webservicespps3416
1/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 1
Web Services
Semantic Web - Fall 2005Computer Engineering Department
Sharif University of Technology
-
8/2/2019 webservicespps3416
2/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 2
2
Outline
What are web services? Definitions Advantages
Challenges Architecture
WS Protocol Stack SOAP
WSDL UDDI Apache Axis
-
8/2/2019 webservicespps3416
3/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 3
3
Web evolution
Programthe Web
XML
Browsethe Web
HTML
TCP/IP
Connectthe Web
Technology
Applications
Text Hypertext ApplicationsFTP,E-mail,Gopher
WebpagesWebservices
-
8/2/2019 webservicespps3416
4/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 4
4
Definitions Definition 1:
A web service is a service (program) that can beinvoked from another program via the web.
Definition 2: Web Services are self-contained, self-describing,
modular applications that can be published, located, andinvoked across the Web. IBM Web Services Tutorial
Definition 3: A Web Service is a service on the Internet that
Use a standardized XML messaging system
Not tied to any operating system or programming language Optional features
Self-describing: provide public interface to the service via acommon XML grammar
Discoverable: Interested parties can find a service andlocate its interface
-
8/2/2019 webservicespps3416
5/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 5
5
Examples Flight Reservation
Weather Service
Amazon.com web services
Retrieve geographic information http://terraserver.microsoft.net/TerraService.asmx
Search the web, check spellings One of the first useful Web Services built around SOAP Allows you to integrate your application with Googles search,
spell check, and cached page databases. http://www.google.com/apis/
http://terraserver.microsoft.net/TerraService.asmxhttp://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://terraserver.microsoft.net/TerraService.asmx -
8/2/2019 webservicespps3416
6/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 6
6
A Basic Web Service
Language: Perl
Operating System:
Windows 2000
Language: Java
Operating System:
Linux
XML
XML
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
7/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 7
7
Web Services Advantages
Use open, text-based standards, which enablecomponents written in different languages and fordifferent platforms to communicate.
Promote a modular approach to programming, somultiple organizations can communicate with thesame Web service.
Self-describing (metadata for access and use)
Discoverable (search and locate in registries)
loosely coupled (i.e. Services should not bedependent on each other).
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
8/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 8
8
Service OrientedArchitecture (Basic Model)
ServiceBroker
ServiceUser
ServiceProvider
Find
Publish Bind
UDDI
WSDL
SOAP
SOAP SOAP
SOAP Simple Object Access Protocol / SOA Protocol
WSDL Web Services Description Language
UDDI Universal, Description, Discovery, and Integration
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
9/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 9
9
Service Interaction
I book planesI book car
RentalsI book hotels
I locate services
I organise
holidaysGet a car rental quotelocate service
ask for quote
Is quote good enough?
Yes
Reserve car, provisionally get other resources reserved
Confirm reservation
ServiceIdentifier
I convert
currency
I know
the weather
quote
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
10/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 10
10
Web Service Protocol Stack
Discovery UDDI
Description WSDL
XML Messaging XML-RPC, SOAP,XML
Transport HTTP,SMTP,FTP
Transporting XML messages between client and server
Encoding messages in XML format
Describing
Web Services
interface
Searching /
Publishing
Web Services
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
11/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 11
11
Simple Object Access Protocol(SOAP)
SOAP is an XML-based protocol designed toexchange information in a distributed environment(a communication protocol).
SOAP is platform & language independent
SOAP is a W3Cstandard
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
12/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 12
12
SOAP: Message Structure
-
8/2/2019 webservicespps3416
13/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 13
13
SOAP: Request Example
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
14/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 14
14
SOAP: Response Example
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
15/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 15
15
SOAPAdvantages/Disadvantages
Advantages Human-readable XML
Easy to debug
SOAP runs over HTTP Firewalls not affected
Services can be written in any language,platform or operating system.
Disadvantages S-L-O.............W
XML produces a lot of overhead for small messages
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
16/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 16
16
WSDL Web Services Description Language WSDL is an XML-based format designed to describe the
interfaces exposed by a service What a service does? How clients can use it?
Separation of abstract service description from concretemessaging format: An abstract section describing the interfaces in a protocol-
independent way A concrete section relating the abstract definitions with the
specific protocols It can be used with all protocols (HTTP, SMTP, etc.), but it
normally runs over HTTP. If sender & receiver share and understand same WSDL file,
interoperability is guaranteed.
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
17/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 17
17
WSDL: Definitions A WSDL document defines services as a collection of network endpoints or
ports, where the port types are abstract collection ofoperations, andthe concrete protocol and data format specifications for a particular porttype constitutes a reusable binding.
Types: a container for data type definitions using some type system suchas XSD.
Message: an abstract, typed definition of the data being communicated.
Operation: an abstract description of an action supported by the service. PortType: an abstract set of operations supported by one or more
endpoints. They are equivalent to interfaces.
Binding: a concrete protocol and data format specification for a particularport type. The interfaces are bound to specific network and transport protocols. It is akin
to implementing an interface. Port: a single endpoint defined as a combination of a binding and a
network address. Service: a collection of related endpoints.
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
18/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 18
18
WSDL Structure
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
19/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 19
19
The
The types element contains XML Schemasdefining the datatypes that are to bepassed to and from the web service
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
20/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 20
20
The The element is used to define the
messages that will be exchanged between theclient and the service
These message elements contain elements, which will be using types defined in thetypes element
All the parts are namespace qualified
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
21/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 21
21
The The types and messages have been defined, but they have
not been defined in terms of where they fit in thefunctionality of the web service
This is done within and elements
A portType is analogous to a class An operation is analogous to a method in that class
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
22/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 22
22
Types of There are four distinct types of operation Synchronous
Request-response - The service receives a messageand sends a reply
Solicit-response - The service sends a message andreceives a reply message
Asynchronous One-way - The service receives a message
Notification - The service sends a message
All of these can be defined in WSDL
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
23/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 23
23
Defining the type ofoperation
Presence and order of input/output elementsdefines the type of operation.
Request-response
Solicit-response
One-way only
Notification only
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
24/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 24
24
The element
This element is used to define the mechanismthat the client will actually use to interact with theweb service
The most common choice is currently SOAP
The binding element defines the protocol specific
information for the portTypes previously defined
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
25/49Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 25
25
The binding tag
The tag indicates that we will map a to aprotocol
Indicates we will be using the SOAP binding extensions to map
the operations.The alternative to rpc is document.
( to use GET/POST use
to use MIME use )
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
26/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 26
26
The final component of a WSDL file is the
element The element defines elements that
specify where requests should be sent
The subelement identifies the URL of theservice
The precise content of elements will be dependentupon the mechanism, i.e. SOAP, HTTP or MIME
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
27/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 27
27
WSDL: Example (1/5)
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
28/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 28
28
WSDL: Example (2/5
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
29/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 29
29
WSDL: Example (3/5)
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
30/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 30
30
WSDL: Example (4/5)
-
8/2/2019 webservicespps3416
31/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 31
31
WSDL: Example (5/5)
My first service
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
32/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 32
32
UDDI Universal Description, Discovery and Integration A Web Service registry & discovery mechanism for
retrieving pointers for web services interfaces Publish your business information and technical
details of your Web Service Search for other Web Services and connect tothem
UDDI is not only limited to XML Web Services The key to the ultimate success of Web services,
but has some key limitations, and alternativediscovery methods are provided by ebXML andWS-Inspection.
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
33/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 33
33
UDDI Details
SOAP is used to talk to UDDI registries
White pages Business information (name, contact info)
Yellow pages Categorization (industry, products, location)
Green pages Technical specifications (service description)
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/ -
8/2/2019 webservicespps3416
34/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 34
34
Addressing Axis EWS JaxMe jUDDI
jUDDI (pronounced "Judy") is an open source Java implementation of the Universal Description,Discovery, and Integration (UDDI) specification for Web Services.
Kandula Mirae Muse Pubscribe Sandesha Scout SOAP TSIK
Woden WSIF
The Web Services Invocation Framework (WSIF) is a simple Java API for invoking Web services,no matter how or where the services are provided.
WSRF WSS4J XML-RPC
http://www.google.com/apis/http://www.google.com/apis/http://www.google.com/apis/http://ws.apache.org/addressing/http://ws.apache.org/axis/http://ws.apache.org/ews/http://ws.apache.org/jaxme/http://ws.apache.org/juddi/http://ws.apache.org/kandula/http://ws.apache.org/mirae/http://ws.apache.org/muse/http://ws.apache.org/pubscribe/http://ws.apache.org/sandesha/http://ws.apache.org/scouthttp://ws.apache.org/soap/http://incubator.apache.org/tsik/http://incubator.apache.org/woden/http://ws.apache.org/wsif/http://ws.apache.org/wsrf/http://ws.apache.org/wss4j/http://ws.apache.org/xmlrpc/http://ws.apache.org/xmlrpc/http://ws.apache.org/wss4j/http://ws.apache.org/wsrf/http://ws.apache.org/wsif/http://incubator.apache.org/woden/http://incubator.apache.org/tsik/http://ws.apache.org/soap/http://ws.apache.org/scouthttp://ws.apache.org/sandesha/http://ws.apache.org/pubscribe/http://ws.apache.org/muse/http://ws.apache.org/mirae/http://ws.apache.org/kandula/http://ws.apache.org/juddi/http://ws.apache.org/jaxme/http://ws.apache.org/ews/http://ws.apache.org/axis/http://ws.apache.org/addressing/ -
8/2/2019 webservicespps3416
35/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 35
35
Apache Axis
Apache Axis is an Open Source SOAPserver and client
It is completely written in Java
The server can be executed as a webapplication into servlet engines such asJakarta Tomcat
-
8/2/2019 webservicespps3416
36/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 36
36
Standard mappings from WSDLto Java
XML Schema Datatype Java Datatype
xsd:base64Binary byte[]
xsd:boolean boolean
xsd:byte bytexsd:dateTime java.util.Calendar
xsd:decimal java.math.BigDecimal
xsd:double double
xsd:float float
xsd:hexBinary byte[]
-
8/2/2019 webservicespps3416
37/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 37
37
Standard mappings from WSDLto Java
XML Schema Datatype Java Datatype
xsd:int int
xsd:integer java.math.BigInteger
xsd:long long
xsd:QName javax.xml.namespace.QName
xsd:short short
xsd:string java.lang.String
P bli hi W b S i
-
8/2/2019 webservicespps3416
38/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 38
38
Publishing Web Serviceswith Axis
Lets say we have a simple Java class likethe following:
public class Converter {
public double toLire(double euro) {
return euro * 1936.27;
}
public double toEuro(double lire) {
return lire / 1936.27;
}
}
P bli hi W b S i
-
8/2/2019 webservicespps3416
39/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 39
39
Publishing Web Serviceswith Axis
JWS (Java Web Service) files Instantdeploying Step 1
Copy Converter.java file into your axis webappdirectory, and rename it as Converter.jws
Step 2 You should now be able to access the service at the
following URL (assuming your Axis web application is
on port 8080):http://localhost:8080/axis/Converter.jws
C i W b S i
http://localhost:8080/axis/Converter.jwshttp://localhost:8080/axis/Converter.jws -
8/2/2019 webservicespps3416
40/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 40
40
Consuming Web Serviceswith Axis
import org.apache.axis.client.Call;import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
publicclass ConverterClient {
publicstaticvoidmain(String args[]) {
try {
String endpoint = "http://localhost:8080/axis/Converter.jws";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new
QName("http://localhost:8080/axis/Converter.jws", "toLire"));Double ret = (Double)call.invoke(new Object[] {new Double(10.0)});
System.out.println("10 euro = " + ret.doubleValue() + " lire");
} catch (Exception e) {
e.printStackTrace();
}
}
}
-
8/2/2019 webservicespps3416
41/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 41
41
Consuming Web Serviceswith .NET (1/2)
C# Client Create a new C# console application project
Add a class called ConverterClient
Add a web reference tohttp://localhost:8080/axis/Converter.jws?wsdlin theproject, otherwise the class ConverterServicewill not be found.
http://localhost:8080/axis/Converter.jwshttp://localhost:8080/axis/Converter.jws -
8/2/2019 webservicespps3416
42/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 42
42
Consuming Web Serviceswith .NET (2/2)
using System;
using ConsoleApplication.localhost;
namespace ConsoleApplication {
///
/// Summary description for Class1.
///
class ConverterClient {
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args) {ConverterService converter = new ConverterService();
System.Console.WriteLine("10 euro = {0}",
converter.toLire(10));
System.Console.ReadLine();
}
}
}
U i th A i TCP M it
-
8/2/2019 webservicespps3416
43/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 43
43
Using the Axis TCP Monitor(tcpmon)
The tcpmon utility keeps a log of allrequest/response SOAP messages
It can be found in the org.apache.axis.utils
package To run it from the command line:
java org.apache.axis.utils.tcpmon
-
8/2/2019 webservicespps3416
44/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 44
44
Publishing Web Serviceswith .NET (1/2)
Visual Studio .NET 2003 From the File menu, point to New, and click
New Project
Select ASP.NET Web service Change the Location if necessary
Click OK
Open the code window
Add the following code
-
8/2/2019 webservicespps3416
45/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 45
45
Publishing Web Serviceswith .NET (2/2)
[WebMethod]
public double toLire(double euro)
{
return euro * 1936.27;
}
[WebMethod]
public double toEuro(double lire)
{
return lire / 1936.27;}
-
8/2/2019 webservicespps3416
46/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 46
46
The Java client (1/2)
Generate the stub to access to the WebServicejava org.apache.axis.wsdl.WSDL2Javahttp://localhost/Converter/Service1.asmx?WSDL
This tool generates the following files: Service1.java
Service1Locator.java
Service1Soap.java
ServiceSoapStub.java
-
8/2/2019 webservicespps3416
47/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 47
47
The Java Client (2/2)import org.tempuri.*;
publicclass DotNetConverterClient {
publicstaticvoidmain(String args[]) {
try {Service1 service = new Service1Locator();
Service1Soap calculator = service.getService1Soap();
System.out.println("10 euro = " + calculator.toLire(10) + "lire");
} catch (Exception e) {
e.printStackTrace();
}
}}
-
8/2/2019 webservicespps3416
48/49
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 48
48
Web Services Challenges
The standards that drive Web services are still indraft form.
Web services need standard securityprocedures (a common problem to all of the
distributed computing solutions). The leading registry, based on the UDDI
specification, has some key limitations, andalternative discovery methods are needed.
Web services need Quality of Service (QoS)support from Web Services Registries, Brokerages,and Network Providers.
-
8/2/2019 webservicespps3416
49/49
49
References
Web Services Activity
http://www.w3.org/2002/ws/
W3C Web Services glossary
http://www.w3.org/TR/ws-gloss/