Documente Academic
Documente Profesional
Documente Cultură
Semantic Web - Fall 2005 Computer Engineering Department Sharif University of Technology
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
Outline
2 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 2
Web evolution
IP TCP/
Text
FTP, E-ma il, Go pher
HTML
Hypertext
XML
Technology
Applications
Applications
Web p ag
es
Web servi ce
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
Definitions
Definition 1:
Definition 2:
A web service is a service (program) that can be invoked from another program via the web. Web Services are self-contained, self-describing, modular applications that can be published, located, and invoked across the Web. IBM Web Services Tutorial A Web Service is a service on the Internet that
Definition 3:
Optional features
Use a standardized XML messaging system Not tied to any operating system or programming language Self-describing: provide public interface to the service via a common XML grammar Discoverable: Interested parties can find a service and locate its interface
4 4
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
Examples
Flight Reservation Weather Service Amazon.com web services Retrieve geographic information
http://terraserver.microsoft.net/TerraService.asmx
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/
5
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
6 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 6
Use open, text-based standards, which enable components written in different languages and for different platforms to communicate. Promote a modular approach to programming, so multiple organizations can communicate with the same Web service. Self-describing (metadata for access and use) Discoverable (search and locate in registries) loosely coupled (i.e. Services should not be dependent on each other).
7
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
Service Provider
Bind
SOAP
Find
SOAP
Service User
SOAP Simple Object Access Protocol / SOA Protocol WSDL Web Services Description Language UDDI Universal, Description, Discovery, and Integration
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 8 8
Service Interaction
Get a car rental quote locate service ask for quote Is quote good enough? Yes Reserve car, provisionally get other resources reserved Confirm reservation
Ser v Ide ice ntifi er
I organise holidays
I locate services
ote qu
I book car Rentals
I book planes
I book hotels
I convert currency
9
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
SOAP is an XML-based protocol designed to exchange information in a distributed environment (a communication protocol). SOAP is platform & language independent SOAP is a W3C standard
11 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 11
SOAP Envelope SOAP Header Headers SOAP Body Message Name & Data
12 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 12
13 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 13
14 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 14
SOAP Advantages/Disadvantages
Advantages
Human-readable XML
Disadvantages
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
15
WSDL
Web Services Description Language WSDL is an XML-based format designed to describe the interfaces exposed by a service
An abstract section describing the interfaces in a protocolindependent 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.
16 16
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
WSDL: Definitions
A WSDL document defines services as a collection of network endpoints or ports, where the port types are abstract collection of operations, and the concrete protocol and data format specifications for a particular port type constitutes a reusable binding. Types: a container for data type definitions using some type system such as XSD. Message: an abstract, typed definition of the data being communicated. Operation: an abstract description of an action supported by the service. Port Type: an abstract set of operations supported by one or more endpoints.
Binding: a concrete protocol and data format specification for a particular port type.
Port: a single endpoint defined as a combination of a binding and a network address. Service: a collection of related endpoints.
The interfaces are bound to specific network and transport protocols. It is akin to implementing an interface.
17 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 17
WSDL Structure
<?xml version="1.0" encoding="UTF-8"?> <definitions> <types> <! define the types here using XML Schema </types> <message> <! XML messages the web service uses are defined here </message> <portType> <! define the input and output parameters here - </portType> <binding> <! define the network protocol here </binding> <service> <! location of the service </service> </definitions>
18 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 18
The <types>
The types element contains XML Schemas defining the datatypes that are to be passed to and from the web service
<types> <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2000/10/XMLSchema"> <element name="TradePriceRequest"> <complexType> <all><element name="tickerSymbol" type="string"/></all> </complexType> </element> <element name="TradePrice"> <complexType> <all><element name="price" type="float"/></all> </complexType> </element> </schema> </types>
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
19 19
The <message>
The <message> element is used to define the messages that will be exchanged between the client and the service These message elements contain <part> elements, which will be using types defined in the types element
<message name="GetLastTradePriceInput"> <part name="body" element="xsd1:TradePriceRequest"/> </message> <message name="GetLastTradePriceOutput"> <part name="body" element="xsd1:TradePrice"/> </message>
20 20
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
The <portType>
The types and messages have been defined, but they have not been defined in terms of where they fit in the functionality of the web service This is done within <portType> and <operation> elements
<portType name="StockQuotePortType"> <operation name="GetLastTradePrice"> <input message="tns:GetLastTradePriceInput"/> <output message="tns:GetLastTradePriceOutput"/> </operation> </portType>
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
21
Types of <operation>
Request-response - The service receives a message and sends a reply Solicit-response - The service sends a message and receives a reply message
Asynchronous
One-way - The service receives a message Notification - The service sends a message
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
22
Presence and order of input/output elements defines the type of operation. Request-response <input><output> Solicit-response <output><input> One-way <input> only Notification <output> only
23 23
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
This element is used to define the mechanism that the client will actually use to interact with the web service The most common choice is currently SOAP The binding element defines the protocol specific information for the portTypes previously defined
24 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 24
<soap:binding style=rpc transport=http://schemas.xmlsoap.org/soap/http/> Indicates we will be using the SOAP binding extensions to map the operations. The alternative to rpc is document. ( to use GET/POST use <http:binding> to use MIME use <mime:binding..> )
25 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 25
<service>
The final component of a WSDL file is the <service> element The <service> element defines <port> elements that specify where requests should be sent
<service name="StockQuoteService"> <port name="StockQuotePort" binding="tns:StockQuoteBinding"> <soap:address location="http://example.com/stockquote"/> </port> </service>
The <soap:address> subelement identifies the URL of the service The precise content of <port> elements will be dependent upon the mechanism, i.e. SOAP, HTTP or MIME
26
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
26
28 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 28
29 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 29
31 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 31
UDDI
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 to them UDDI is not only limited to XML Web Services The key to the ultimate success of Web services, but has some key limitations, and alternative discovery methods are provided by ebXML and WS-Inspection.
32
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
32
UDDI Details
Business information (name, contact info) Categorization (industry, products, location) Technical specifications (service description)
Yellow pages
Green pages
33 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 33
Kandula Mirae Muse Pubscribe Sandesha Scout SOAP TSIK Woden WSIF
jUDDI (pronounced "Judy") is an open source Java implementation of the Universal Description, Discovery, and Integration (UDDI) specification for Web Services.
The Web Services Invocation Framework (WSIF) is a simple Java API for invoking Web services, no matter how or where the services are provided.
34 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 34
Apache Axis
Apache Axis is an Open Source SOAP server and client It is completely written in Java The server can be executed as a web application into servlet engines such as Jakarta Tomcat
35 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 35
36 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 36
37 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 37
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
38
Step 1
Copy Converter.java file into your axis webapp directory, and rename it as Converter.jws 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
Step 2
39 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 39
C# Client
Create a new C# console application project Add a class called ConverterClient Add a web reference to http://localhost:8080/axis/Converter.jws?wsdl in the project, otherwise the class ConverterService will not be found.
41 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 41
42 42
java org.apache.axis.utils.tcpmon
43 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 43
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
44 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 44
45 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 45
46 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 46
} }
47 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 47
The standards that drive Web services are still in draft form. Web services need standard security procedures (a common problem to all of the distributed computing solutions). The leading registry, based on the UDDI specification, has some key limitations, and alternative discovery methods are needed. Web services need Quality of Service (QoS) support from Web Services Registries, Brokerages, and Network Providers.
48
Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005
48
References
http://www.w3.org/2002/ws/ http://www.w3.org/TR/ws-gloss/
49 Semantic web course Computer Engineering Department Sharif Univ. of Technology Fall 2005 49