Download presentation
Presentation is loading. Please wait.
1
Applications of XML Web Services RSS RDF
2
Web Services
3
DBI 2007 HUJI-CS 3 "Web services are loosely coupled software components delivered over standard Internet technologies." "Web services are loosely coupled software components delivered over standard Internet technologies."
4
DBI 2007 HUJI-CS 4 Example Scenario: Get Online Information Stock Exchange Stock Broker Application Get Stock Price Return Stock Price Return Stock Price
5
DBI 2007 HUJI-CS 5 Book Store The Hobbit (5) Price: 25.95 Copies in Stock: 1 The Hobbit (5) Price: 25.95 Copies in Stock: 0 Book Store The Hobbit (5) Price: 20.95 Copies in Stock: 5 Buy The Hobbit (5) How Much? 20.95 Buy it The Hobbit (5) Price: 20.95 Copies in Stock: 4 The Hobbit (5) Price: 25.95 Copies in Stock: 1 The Hobbit (5) Price: 25.95 Copies in Stock: 0 Example Scenario – Online Trade
6
DBI 2007 HUJI-CS 6 Example Scenario: Grid Computation Grid Computation Using seamlessly the combined resources of many computers that are connected to the Internet
7
DBI 2007 HUJI-CS 7 What is a Web Service? Self-contained, modular Web application that can be published, located and invoked across the Web A Web service can perform functions of varying complexities Once deployed, other applications (and other Web services) can discover and invoke the deployed service
8
DBI 2007 HUJI-CS 8 Calling Remote Functions Could Help It would help if we could call functions, such as: –Amazon.getPrice(“The Hobbit") –Amazon.buyBook(“The Hobbit", myId) getPrice(…) The Internet
9
DBI 2007 HUJI-CS 9 Difficulties in Using Remote Functions For each remote function, we need to phrase a call in the specific language that is used for its implementation For each remote function, we need to contact the provider in order to find out what exactly the signature (i.e., parameters, return value, inc. the type) is On the server side, each remote function needs to listen to a server socket bound to a specific port –Not in line with protection by firewalls
10
DBI 2007 HUJI-CS 10 The Solution Use an agreed interface and a syntax that all applications are familiar with (e.g., XML) –For example, SOAP Use HTTP to transfer data through port 80 Use a standard for publishing methods, their signatures and their usage –For example, WSDL Use standard directory structures for publishing available services –For example, UDDI
11
DBI 2007 HUJI-CS 11
12
DBI 2007 HUJI-CS 12 Web Services that are Already Available Google search (http://www.google.com/apis) Weather reports Stock prices Currency exchanges Sending SMS messages, faxes Prices of books in Barnes and Nobles Dictionaries etc.
13
DBI 2007 HUJI-CS 13 Implementing Web Services Programmers are given tools that spare the need to directly write SOAP or WSDL documents In Java: –JAX-RPC: part of SUN tools for publishing and deploying Web Services –AXIS: Apache’s tool for handling Web services in Java The combination of standards and management tools (like Axis – next week) makes the invocation of remote methods a very easy operation
14
DBI 2007 HUJI-CS 14 Programming the Services What programming language is used for Web Services? –They are independent from programming language –HTTP can be implemented in any language –XML contains data but not object (no methods, etc.) objects can be represented in XML and vice versa –SOAP builds on top of XML (Infoset) Typical languages: –Java, C#, Perl, PHP, Python, Ruby, …
15
SOAP Simple Object-Access Protocol
16
DBI 2007 HUJI-CS 16 What is SOAP? SOAP is a protocol for accessing Web Services SOAP is XML based –Thus, SOAP provides interoperability In SOAP, applications exchange information over HTTP –Thus, SOAP is not restricted by firewalls SOAP allows to exchange structured and typed information on the Web –XSchema types are used to add types to XML SOAP specification: http://www.w3.org/2000/xp/Group/ http://www.w3.org/2000/xp/Group/
17
DBI 2007 HUJI-CS 17 SOAP Communication
18
DBI 2007 HUJI-CS 18 Soap Structure Put a message into an envelope and describe additional features in the header (payment, etc.) SOAP Envelope SOAP Header SOAP Body - required - optional Fault - optional
19
DBI 2007 HUJI-CS 19 POST /soap HTTP/1.0 SOAPAction: "" Content-Length: 520 < soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ns1:getRate soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:xmethods-CurrencyExchange"> Euro Israel A request to services.xmethods.net:80
20
DBI 2007 HUJI-CS 20 HTTP/1.0 200 OK Date: Sat, 07 May 2005 23:26:21 GMT Content-Length: 492 Content-Type: text/xml <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' soap:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'> < n:getRateResponse xmlns:n='urn:xmethods-CurrencyExchange'> 5.5825 The Response
21
DBI 2007 HUJI-CS 21 Example - Calling Google Spelling <SOAP-ENV:Envelope xmlns:SOAP ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:xsi=“http://www.w3.org/1999/XMLSchema-instance” xmlns:xsd=“http://www.w3.org/1999/XMLSchema”> 00000000000000000000000000 britney speers
22
DBI 2007 HUJI-CS 22 Example - Google Spelling Response <SOAP-ENV:Envelope xmlns:SOAP ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <ns1:doSpellingSuggestionResponse xmlns:ns1="urn:GoogleSearch“ SOAP- ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> britney spears
23
DBI 2007 HUJI-CS 23 MD5 Transform MD5 Transform
24
DBI 2007 HUJI-CS 24 Baghdad Weather
25
DBI 2007 HUJI-CS 25 Baghdad Weather
26
DBI 2007 HUJI-CS 26 World Cities
27
DBI 2007 HUJI-CS 27 World Cities
28
DBI 2007 HUJI-CS 28 Messaging Patterns Synchronous –Remote procedure call –Standard HTTP request response What are the limitations here? ServiceAServiceA ClientClient message reply
29
DBI 2007 HUJI-CS 29 Asynchronous Messaging Asynchronous –A message is sent with directions on where to send the reply when it is ready. Generalize the callback model –Document oriented –Tolerates long latencies Destination of reply may be different from origin Message may transit several other services Analogy: Mail, Email, … To: From: ServiceAServiceA ClientClient message ServiceBServiceB ServicecServicec ReplyDest.ReplyDest. reply
30
DBI 2007 HUJI-CS 30 The SOAP Header A generic mechanism for adding features to a SOAP message Contained in the header are header blocks –Some header blocks are marked as mandatory (mustUnderstand=“true”) the rest can be ignored. The header blocks contain answers to questions like –Where to send a reply or fault message i.e. how to handle asynchronous messaging –What are the security requirements of this message –Other “policy” issues that are involved –Used by the reliable message protocol The header is the place where protocol composability takes place
31
DBI 2007 HUJI-CS 31WS-Addressing A soap header used to –Specify the final destination and action of a message –A unique identifier for the message –The endpoint of a reply –The endpoint of a fault message –The details of an endpoint reference <S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2004/12/addressing"> http://Z.com/ServiceURI http://Z.com/DoSomething http://example.com/SomeUniqueMessageIdString http://X.com/someClient http://Y.com//ErrorHandler
32
DBI 2007 HUJI-CS 32 What is an endpoint reference? Specifies the complete details about how to get to and identify a service –My address … The simplest form – http://X.com/myservice But more complex forms are possible –For example qualifying a level of service http://housepainting.com Basic Paint Job
33
Some More Details on SOAP
34
DBI 2007 HUJI-CS 34 encodingStyle Attribute “The SOAP encodingStyle attribute indicates the encoding rules used to serialize parts of a SOAP message” –Needed when sending data structures This attribute may appear on any SOAP element, and it will apply to that element's content and all child elements A SOAP message has no default encoding –Unencoded data may be used in SOAP messages The SOAP default XMLSchema for SOAP encoding and data types is: http://www.w3.org/2002/12/soap-encoding –Other encoding rules may be used
35
DBI 2007 HUJI-CS 35 SOAP Header Element The SOAP Header element is optional It contains application-specific information (like authentication, payment, etc.) about the SOAP message If the Header element is present, it must be the first child element of the Envelope element Attributes that the namespace defines: –Role – used to address the Header element to particular servers (relevant to p2p scenarios where a message can reach several servers) –mustUnderstand – used to indicate whether a header entry is mandatory or optional for the recipient to process –encodingStyle – as explained before
36
DBI 2007 HUJI-CS 36 SOAP Header Element Example: <t:Transaction xmlns:t="some-URI" SOAP-ENV:mustUnderstand="1">5 5 is the transaction ID of which this method is a part In the above example, the SOAP-envelope attribute mustUnderstand is set to 1, which means that the server must either understand and honor the transaction request or must fail to process the message
37
DBI 2007 HUJI-CS 37 SOAP Response on Error There can be many errors in processing a SOAP request Error in Running Methods: For example, suppose that the "Hello Server" does not allow anyone to say hello on Tuesday Error in Processing SOAP Headers: For example, a problem running the method as a part of a transaction
38
DBI 2007 HUJI-CS 38 The Fault Element May Include the Following Sub-Elements : A code for identifying the fault : A human readable explanation of the fault : Information about who caused the fault : Holds application-specific error information related to the Body element of the SOAP request
39
DBI 2007 HUJI-CS 39 SOAP Fault Codes VersionMismatch: Found an invalid namespace for the SOAP Envelope element MustUnderstand: An immediate child element of the Header element, with the mustUnderstand attribute set to 1, was not understood Client: The message was incorrectly formed or contained incorrect information Server: There was a problem with the server so the message could not proceed
40
DBI 2007 HUJI-CS 40 SOAP Error Response for Method Error SOAP-ENV:Server Server Error Sorry, I cannot say hello on Tuesday. 1001
41
DBI 2007 HUJI-CS 41 SOAP Error Response for Header Error SOAP-ENV:MustUnderstand SOAP Must Understand Error No detail element may appear when there is an error in processing the Headers of a SOAP request
42
DBI 2007 HUJI-CS 42 Sending a Request The SOAP request does not contain the address to which it should be sent Q: Where do we put the URL of the Web Service? A: It depends on the protocol used to send the request (usually HTTP, but could also be another protocol, e.g., SMTP)
43
DBI 2007 HUJI-CS 43 SOAP Request via HTTP POST http://www.Hello.com/HelloApplication HTTP/1.0 Content-Type: text/xml; charset=UTF-8 Content-Length: 587 SOAPAction: urn:helloApp <SOAP-ENV:Envelope … Note: There are 2 addresses (1) URL of a SOAP Server (2) URI of an application to run (this needn't correspond to an actual Internet address)
44
DBI 2007 HUJI-CS 44 SOAPAction Header Used to indicate the intent of the SOAP HTTP request The presence and content of the SOAPAction header field can be used by servers, such as firewalls, to appropriately filter SOAP request messages in HTTP The header-field value of an empty string ("") means that the intent of the SOAP message is provided by the URL of the HTTP Request
45
WSDL Web Services Definition Language
46
DBI 2007 HUJI-CS 46 Describing a Web Service Need a standard way to describe a Web Service: –the methods available –their parameters –etc. WSDL is a standard for describing Web services using XML, i.e., it is a language for the green pages of UDDI WSDL specification can be found at http://www.w3.org/TR/wsdl http://www.w3.org/TR/wsdl
47
DBI 2007 HUJI-CS 47 The Web Service Definition Language A document used by a client so that it has a formal description of a service Client fetches the WSDL for a service from some location Client uses the WSDL to properly format the SOAP request and to understand the reply Service Registry WSDL for Service X ServiceXServiceX ClientClient message reply 1 2 3 4
48
DBI 2007 HUJI-CS 48 WSDL Can Describe What a Web service can do Where it resides How to invoke it
49
DBI 2007 HUJI-CS 49 The Structure of a WSDL Document definition of a type definition of a message def. of operations (composed of messages) how to translate operations into SOAP the location of the service
50
DBI 2007 HUJI-CS 50 <definitions name="CurrencyExchangeService" targetNamespace="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl" xmlns:tns="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
51
DBI 2007 HUJI-CS 51 <soap:body use="encoded" namespace="urn:xmethods-CurrencyExchange" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <soap:body use="encoded" namespace="urn:xmethods-CurrencyExchange" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> Returns the exchange rate between the two currencies
52
DBI 2007 HUJI-CS 52 Types – containing XML Schema element and type definitions 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 communication 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 named ports, each associated with a binding and a network address The Elements of WSDL Documents
53
DBI 2007 HUJI-CS 53 Putting it together A client uses the wsdl to guide the creation of the body of the soap message The header of the soap message is primarily used to add additional protocol information –For example, the wsdl does not tell us where to send the reply –So far it does not tell us about security or reliability requirements or other policy issues Service Registry WSDL for Service X ServiceXServiceX ClientClient message reply 1 2 3 4
54
R S S R eally S imple S yndication
55
DBI 2007 HUJI-CS 55 What is RSS? RSS is used for effectively publishing headlines and frequently updated content RSS files (also called RSS feeds) are XML that conform to a very simple schema Publishers make the RSS feed available on the Web –ynet: http://www.ynet.co.il/Integration/StoryRss2.xml –cnn: http://rss.cnn.com/rss/cnn_topstories.rss –Intel products: http://rss.intel.com/rss/intel-products.xml RSS readers are responsible for being updated –That is, have the most recent copy of the feed
56
DBI 2007 HUJI-CS 56 So Why RSS? A standard, unified way of distributing headlines –Application readers need only to know the feed URL –Easy to query (“anything new about the middle east?”) and integrate news from multiple sources Efficiency : RSS feeds typically contain a small fragment of text for each news item –Thus, a lot of traffic is saved –Compare it to downloading the Web page of the publishing company
57
DBI 2007 HUJI-CS 57 Mozilla’s Reader
58
DBI 2007 HUJI-CS 58 Goggle’s Reader
59
DBI 2007 HUJI-CS 59 Example: Ynet Feed ynet - Updates for RSS http://www.ynetnews.com/home/0,7340,L-3254,00.html Ynet - news and content from Israel (Yedioth Ahronoth web site) en Sun, 15 Apr 2007 00:03:31 +0200 Ynet http://www.ynetnews.com/home/0,7340,L-3254,00.html http://www.ynetnews.com/images/ECENTRAL_logo.gif
60
DBI 2007 HUJI-CS 60 Example: Ynet Feed (cont’d) Updates Egypt pours cold water on talk of "Negotiations" http://www.ynetnews.com/articles/0,7340,L-3387877,00.html Sat, 14 Apr 2007 23:51:24 +0200 http://www.ynetnews.com/articles/0,7340,L-3387877,00.html Updates US: N. Korea must immediately invite IAEA inspectors http://www.ynetnews.com/articles/0,7340,L-3387866,00.html Sat, 14 Apr 2007 22:30:39 +0200 http://www.ynetnews.com/articles/0,7340,L-3387866,00.html …
61
DBI 2007 HUJI-CS 61 The Channel Element This element represents the feed itself A channel contains item elements and, in addition, other elements that describe the feed Three sub-elements are required title, link and description The channel of the previous example had also an image and a language sub-elements
62
DBI 2007 HUJI-CS 62 The item Element Each item element defines one news item An item has three mandatory sub-elements: –The title of the item –A description of the item –A link (usually, points to a Web interface of the item) Optional sub-elements: –pubDate – date of publication –comments – a link to comments about the item –category
63
DBI 2007 HUJI-CS 63 Title, Link Description
64
R D F R esource D escription F ramework
65
DBI 2007 HUJI-CS 65 The Semantic Web Vision The vision of the semantic-Web activity is that Web data will entail the semantics of data in a manner that is understood (and can be processed) automatically by computers –Common formats –Documents integrate data from diverse resources (rather than invent their own specific objects) –A language that specifies how the data relates to real- world objects Instantiated by developing a variety of languages and specifications (RDF, SPARQL, OWL, …)
66
DBI 2007 HUJI-CS 66 What is RDF? A part of the semantic-Web activity RDF is a general-purpose language for representing information on the Web –Specifically, objects and relationships Designed to allow computer applications to process data based on its semantics –Rather than displaying data to humans (as opposed to RSS) An RDF document is actually a labeled graph that is represented in XML –The specific language is called RDF/XML –W3C recommendation (Feb. 2004)
67
DBI 2007 HUJI-CS 67 RDF Data Subject Object predicate The basic element: Triple (labeled edge) Person#845 #1002 address postalCode 6941 Netanya city Herzel street RDF document: edge-labeled graph
68
DBI 2007 HUJI-CS 68 The XML Syntax of RDF page.html John Smith John’s Home Page DC:Creator DC:Title John Smith John’s Home Page
69
DBI 2007 HUJI-CS 69 Structured Values page.html John Smith John’s Home Page js@corp.com dc:Title dc:Creator NameEmail... John Smith js@corp.com John’s Home Page
70
DBI 2007 HUJI-CS 70 A set of fifteen basic properties for describing generalized Web resources The “obvious” mapping of Dublin Core properties into RDF properties has not yet been approved by the Dublin Core initiative, but is generally a good example Dublin Core
71
DBI 2007 HUJI-CS 71 “Title”: the name given to the resource “Creator”: the person or organization primarily responsible for the resource “Subject”: what the resource is about “Description”: a description of the content “Publisher”: the person or organization responsible for making the resource available “Contributor”: someone who has provided content to the resource other than the creator “Date”: date of creation or publication Dublin Core
72
DBI 2007 HUJI-CS 72 “Type”: type of resource, such as home page, technical report, novel, photograph… “Format”: data format of the resource “Identifier”: URL, ISBN number, … “Source”: another resource that this resource is derived from “Language”: the language of the content “Relation”: another resource and its relationship to this one “Coverage”: the portion of time or space described by this resource (atlases, histories, etc.) “Rights”: the intellectual property rights adhering to this resource, or a pointer to them Dublin Core
73
Concise Introduction to RDF: Found in www.vanx.org, by Yuri Khramov, SchemaSoft
74
DBI 2007 HUJI-CS 74 1. Semantic Web Initiative and Metadata 2. Resource Description Framework (RDF) basics 3. Advanced topics: collections, reification 4. Vocabularies: Dublin Core, RSS,.. 5. RDF Schema 6. How to get RDF to work? 7. ConclusionOutline
75
DBI 2007 HUJI-CS 75 The Web was built for human consumption, and although everything on it is machine-readable, this data is not machine-understandable Semantic Web -- a web of data that can be processed directly or indirectly by machines The solution proposed here is to use metadata to describe the data contained in the Web Semantic Web
76
DBI 2007 HUJI-CS 76 RDF Basics Resources Properties that have Values Statement: Resource A has property B with Value C A B C
77
DBI 2007 HUJI-CS 77 www.vanx.org/presentations/RDF Yuri Khramov Yurik@schemasoft.com Author Mail address Name
78
DBI 2007 HUJI-CS 78 Containers: bags, sequences, alternatives aboutEach, aboutEachPrefix Reification (higher order statements) Namespaces and Vocabularies Advanced RDF
79
DBI 2007 HUJI-CS 79 Defined as Open Metadata Usual “Library Catalog” Elements, like Creator, Title, Publisher, Date, Language Extended by: Source, Relations,Type (what is it – text, image, software), Format URI (Identifier) Used for cataloging “Global Web Library” Others: RSS (RDF Site Summary) – NetScape, PRISM – publishing – Adobe, Quark,.. - e-business – EU companies RDF mappings for P3P, PICS,… Dublin Core et al.
80
DBI 2007 HUJI-CS 80 Not an XML Schema! A “companion” specification for RDF spec Class, Type, subClassOf, domain, range Misc: label, comment, isDefinedBy,etc. RDF Schema
81
DBI 2007 HUJI-CS 81 Manually from HTML or “user domain XML” With special assisting tools – like Protégé, Reggie, DC-dot, RDF for XML Ideally – with some automated procedure from HTML/XML documents Can we use XSLT there? Creating RDF documents
82
DBI 2007 HUJI-CS 82 IBM’s Java Central Station (uses RDF) Mozilla’s Aurora (RDF-based) MUZE DATAX project Can we use RDF now?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.