web based applications - iit kharagpurcse.iitkgp.ac.in/~pallab/web-services/web-service.pdf ·...

23
Web Based Applications

Upload: others

Post on 24-Jan-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Web Based Applications

Page 2: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Basic Building Blocks

• HTTP/HTTPS • XML

– EXtensible Markup Language – Designed to carry data – User-defined tags

<?xml version="1.0" encoding="ISO-8859-1"?> <note id="501" >

<to>ABC</to> <from>XYZ</from> <heading>Reminder</heading>

<body>Call 123</body>

</note>

Page 3: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

XML Namespace <root> <h:table xmlns:h="http://www.w3.org/TR/html4/"> <h:tr> <h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr> </h:table> <f:table xmlns:f="http://www.w3schools.com/furniture"> <f:name>African Coffee Table</f:name> <f:width>80</f:width> <f:length>120</f:length> </f:table> </root>

Page 4: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

XML Schema <?xml version="1.0"?> <note xmlns=“http://www.w3schools.com” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation="http://www.w3schools.com note.xsd"> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>

Page 5: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

XML Schema <?xml version="1.0"?> <xs:schema xmlns:xs=“http://www.w3.org/2001/XMLSchema” targetNamespace=“http://www.w3schools.com” xmlns=“http://www.w3schools.com” elementFormDefault="qualified"> <xs:element name="note"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> ….. </xs:sequence> </xs:complexType> </xs:element> </xs:schema>

Page 6: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Web Services • Defined as “a software

system designed to support interoperable Machine to Machine interaction over a network “

• Components are – SOAP – WSDL – UDDI

Page 7: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

SOAP • Simple Object Access Protocol • A protocol for exchanging XML-based

messages over computer networks • Works on top of HTTP/HTTPS • Advantage

– Work over http proxies • Disadvantage

– Slower

Page 8: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

SOAP Message

A SOAP message contains: – Envelope element – Header element (optional) – Body element – Fault element (optional)

Page 9: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

SOAP Message Example

<?xml version="1.0"?> <soap:Envelope xmlns: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>

Page 10: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Request <?xml version="1.0"?> <soap:Envelope xmlns:soap=“http://www.w3.org/2001/12/soap-envelope” soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body> <m:GetPrice xmlns:m="http://www.w3schools.com/prices"> <m:Item>Apples</m:Item> </m:GetPrice> </soap:Body> </soap:Envelope>

Page 11: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Response

<?xml version="1.0"?> <soap:Envelope xmlns:soap=“http://www.w3.org/2001/12/soap-envelope” soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body> <m:GetPriceResponse xmlns:m="http://www.w3schools.com/prices"> <m:Price>1.90</m:Price> </m:GetPriceResponse> </soap:Body> </soap:Envelope>

Page 12: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

WSDL

• Web Service Description Language • Provides a model for describing Web

Services • Defines services as collections of network

endpoints, or ports • Client program parses the WSDL

description of the services offered by the server

Page 13: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Document Structure <definitions> <types>…………definition of types........……</types> <message>.……definition of a message......</message> <portType>.……definition of a port...............</portType> <binding>………definition of a binding……..</binding> </definitions>

Page 14: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

WSDL Example <message name="getTermRequest"> <part name="term" type="xs:string"/> </message> <message name="getTermResponse"> <part name="value" type="xs:string"/> </message> <portType name="glossaryTerms"> <operation name="getTerm"> <input message="getTermRequest"/> <output message="getTermResponse"/> </operation> </portType>

Page 15: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Example contd. <binding type="glossaryTerms" name="b1"> <soap:binding style="document“ transport="http://schemas.xmlsoap.org/soap/http" /> <operation> <soap:operation soapAction="http://example.com/getTerm"/> <input> ……<soap:body use="literal"/> …….</input> <output>…..<soap:body use="literal"/>………</output>

</operation>

</binding>

Page 16: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

UDDI • Universal Description, Discovery and Integration • A platform-independent, XML-based registry for

businesses worldwide to list themselves on the Internet • Open industry initiative, sponsored by OASIS • Consists of the following components

– White Pages • Information about WS providers

– Yellow Pages • Available Web services

– Green Pages • Technical interfaces for to access and manage WS

Page 17: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Models of Web Services

• RPC • Message Oriented • Service Oriented • Resource Oriented • Policy Based

Page 18: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

BPEL4WS

• Used for defining a new Web service by composing a set of existing services

• Primitive activities – Invoke, Receive, Reply, Wait, Assign, Throw,

Terminate. • Structure activities

– Sequence, Switch, While, Pick, Flow • Partners

Page 19: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Example

Page 20: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Semantic Web • Goal is to express the web content in such a

format, which can be read and used by software • Uses the following standards

– XML – XML Schema – RDF – RDF Schema – OWL – SPARQL

Page 21: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Semantic Web Contd.

• RDF – a general method of modeling information,

through a variety of syntax formats – Expresses knowledge about resources in the

form of subject-predicate-object expressions – Resource is named by Uniform Resource

Identifier (URI).

Page 22: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Semantic Web contd.

• XML Schema – expresses a schema: a set of rules to which an

XML document must conform in order to be considered 'valid' according to that schema

• RDF Schema – Knowledge representation language – Describes predominantly in terms class,

subclass, domain and range

Page 23: Web Based Applications - IIT Kharagpurcse.iitkgp.ac.in/~pallab/web-services/Web-Service.pdf · 2014. 5. 8. · Web Based Applications . Basic Building Blocks • HTTP/HTTPS ... Web

Semantic Web contd.

• OWL – Web Ontology Language – adds more vocabulary for describing properties

and classes than RDF Schema • SPARQL

– protocol and query language for semantic web data sources