Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr...

50
Programming for WWW Programming for WWW (ICE 1338) (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko .AT. i cu . ac.kr Information and Communications University (ICU)

Transcript of Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr...

Page 1: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

Programming for WWWProgramming for WWW(ICE 1338)(ICE 1338)

Lecture #12Lecture #12 August 4, 2004

In-Young Koiko .AT. icu.ac.kr

Information and Communications University (ICU)

Page 2: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 2 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

AnnouncementsAnnouncements

Homework #3Homework #3 is due by today is due by today Scores of homework#2 have been posed on Scores of homework#2 have been posed on

the Webthe Web If you haven’t, please submit homework #2 If you haven’t, please submit homework #2

as soon as possibleas soon as possible

Page 3: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 3 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Review of the Previous LectureReview of the Previous Lecture

XML Addressing and LinkingXML Addressing and Linking Database Access on the WebDatabase Access on the Web

Page 4: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 4 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Contents of Today’s LectureContents of Today’s Lecture

Web-based Program UnitsWeb-based Program Units Web ServicesWeb Services

Service-oriented ArchitectureService-oriented Architecture RPC (Remote Procedure Call)RPC (Remote Procedure Call) Web Services ArchitectureWeb Services Architecture SOAP (Simple Object Access Protocol)SOAP (Simple Object Access Protocol) WSDL (Web Services Description Language)WSDL (Web Services Description Language) UDDI (UDDI (Universal Description, Discovery and Universal Description, Discovery and

Integration)Integration) Web Services PlatformsWeb Services Platforms

Page 5: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 5 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Web-based Program UnitsWeb-based Program Units

Web ClientWeb Client Web ServerWeb Server

HTML FormsHTML Forms CGI ProgramsCGI Programs

(Perl, PHP)(Perl, PHP)JavaScriptJavaScript

AppletsApplets Servlets (JSP)Servlets (JSP)

JDBC, JDBC, Perl/MySQL, Perl/MySQL, PHP/MySQLPHP/MySQL

DB ServerDB Server

JDBC, JDBC, Perl/MySQL, Perl/MySQL, PHP/MySQLPHP/MySQL

Page 6: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 6 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Software Crisis – 1960sSoftware Crisis – 1960s

Machines have become several orders of Machines have become several orders of magnitude more powerful than software magnitude more powerful than software [Edsger Dijkstra][Edsger Dijkstra]

A large software projectA large software project: a monster of : a monster of missed schedules, blown budgets, and missed schedules, blown budgets, and flowed productsflowed products [Frederick Brooks][Frederick Brooks] WerewolfWerewolf

IBM 7090 – A second generation computercomputer

Page 7: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 7 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

A Silver BulletA Silver Bullet Searching for a silver bullet to kill the Searching for a silver bullet to kill the

monster of a large software projectmonster of a large software project

What would be the silver bullet??What would be the silver bullet?? Structured Programming?Structured Programming? Object-Oriented Programming?Object-Oriented Programming? Component-Based Software Development?Component-Based Software Development? Service-Oriented Software DevelopmentService-Oriented Software Development??

WerewolfWerewolf

Page 8: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 8 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

The Web: A New Infrastructure for The Web: A New Infrastructure for Software EngineeringSoftware Engineering

Provides Provides repositoriesrepositories for searchingfor searching software software component servicescomponent services

Provides a Provides a mediummedium for deployingfor deploying software software components as servicescomponents as services

Provides Provides protocolsprotocols to accessto access software software servicesservices

Provides an Provides an environment to dynamically environment to dynamically compose (assemble or synthesize)compose (assemble or synthesize) software software systemssystems

Page 9: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 9 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Service-Oriented ApproachService-Oriented Approach Service-oriented approach is getting popularService-oriented approach is getting popular

““By 2005, the aggressive use of Web Services By 2005, the aggressive use of Web Services will drive a 30 percent increase in the efficiency will drive a 30 percent increase in the efficiency of IT development projectsof IT development projects”” [Gartner][Gartner]

Conventional software market will be Conventional software market will be disappeared and changed to “disappeared and changed to “software as a software as a serviceservice”” [Oracle][Oracle]

What are Services?What are Services? Self-contained functionsSelf-contained functions Can be composed with other services to form Can be composed with other services to form

different servicesdifferent services

Page 10: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 10 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Benefits of Using ServicesBenefits of Using Services

Inheriting of the benefits of component-based Inheriting of the benefits of component-based software engineeringsoftware engineering Rapid software development (outsourcing)Rapid software development (outsourcing) Enhanced adaptabilityEnhanced adaptability ScalabilityScalability MaintainabilityMaintainability

User-oriented views (abstraction)User-oriented views (abstraction) Loose couplingLoose coupling AsynchronyAsynchrony Agility (dynamic service composition)Agility (dynamic service composition)

Page 11: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 11 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Service-oriented Architectures (SOA)Service-oriented Architectures (SOA)

SOA is a form of SOA is a form of distributed systems architecturedistributed systems architecture that is composed of loosely coupled services, which that is composed of loosely coupled services, which interact with each other by exchanging messagesinteract with each other by exchanging messages

Service Service ConsumerConsumer

Service Service ProviderProvider

Service Request Service Request MessageMessage

Service Response Service Response MessageMessage

Page 12: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 12 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

SOA PropertiesSOA Properties Logical viewLogical view: The service is an abstracted, logical view of : The service is an abstracted, logical view of

actual programs, databases, business processes, etc., actual programs, databases, business processes, etc., defined in terms of what it doesdefined in terms of what it does

Message orientationMessage orientation: The service is formally defined in : The service is formally defined in terms of the messages exchanged between provider agents terms of the messages exchanged between provider agents and requester agents, and not the properties of the agentsand requester agents, and not the properties of the agents

Description orientationDescription orientation: A service is described by machine-: A service is described by machine-processable meta dataprocessable meta data

GranularityGranularity: Services tend to use a small number of : Services tend to use a small number of operations with relatively large and complex messagesoperations with relatively large and complex messages

Network orientationNetwork orientation: Services tend to be oriented toward : Services tend to be oriented toward use over a networkuse over a network

Platform neutralPlatform neutral: Messages are sent in a platform-neutral, : Messages are sent in a platform-neutral, standardized format delivered through the interfaces (in XML)standardized format delivered through the interfaces (in XML)

http://www.w3.org/TR/ws-arch/

Page 13: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 13 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Service Abstraction in SOAService Abstraction in SOA

The The internal structureinternal structure of an agent, including of an agent, including features such as its implementation language, features such as its implementation language, process structure and even database structure, process structure and even database structure, are deliberately are deliberately abstracted awayabstracted away in the SOA in the SOA

A key benefit of this concerns so-called A key benefit of this concerns so-called legacy legacy systemssystems. By avoiding any knowledge of the . By avoiding any knowledge of the internal structure of an agent, one can incorporate internal structure of an agent, one can incorporate any software component or application that can any software component or application that can be be "wrapped" in message handling code"wrapped" in message handling code that that allows it to adhere to the formal service definition.allows it to adhere to the formal service definition.

Page 14: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 14 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Difficulties in Using Web WrappersDifficulties in Using Web Wrappers

http://http://websearch.naver.comwebsearch.naver.com/search.naver/search.naver??where=webkrwhere=webkr&query=www&query=www&xc=&qt=df&f=all&r=&st=&xc=&qt=df&f=all&r=&st=s&fd=1s&fd=1&start=101&display=10&start=101&display=10&domain=&dftf=&qf=1&domain=&dftf=&qf=1&qvt=0&qvt=0

Need to analyze how Need to analyze how to to generate a URLgenerate a URL

Need to Need to parse Web parse Web pagespages to obtain result to obtain result datadata

Need to Need to modify the modify the wrapperwrapper when the when the result page format is result page format is changedchanged

Page 15: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 15 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

What would be better?What would be better?

Access the Web site as if we call functions:Access the Web site as if we call functions:e.g., e.g., result = Naver.webSearch(“ICU”);result = Naver.webSearch(“ICU”);

String[] titles = result.getTitles();String[] titles = result.getTitles();

String[] urls = result.getURLs();String[] urls = result.getURLs(); APIs are independent from the changes on APIs are independent from the changes on

the layout of the result pagesthe layout of the result pages Use Use standard protocolsstandard protocols such as HTTP to such as HTTP to

directly access the Web site from a programdirectly access the Web site from a program

Page 16: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 16 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Solution: Web ServicesSolution: Web Services

xmethods.comxmethods.com

Provides a list of Provides a list of publicly available publicly available Web ServicesWeb Services

Allow users to test Allow users to test Web Services via a Web Services via a Web-based interfaceWeb-based interface

Page 17: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 17 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Web ServicesWeb ServicesWeb services provide a Web services provide a standard meansstandard means of interoperating of interoperating between different software applicationsbetween different software applications, running on a , running on a variety of platforms and/or frameworksvariety of platforms and/or frameworks [W3C] [W3C]

Software ComponentsSoftware Components

External Software SystemExternal Software System

ServicesServices

External UsersExternal Users

Web Services PlatformWeb Services Platform WSDL, SOAP, UDDIWSDL, SOAP, UDDI

Page 18: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 18 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Benefits of Using Web ServicesBenefits of Using Web Services

Inheriting the benefits of service-oriented Inheriting the benefits of service-oriented software developmentsoftware development Enable outsourcing servicesEnable outsourcing services Adaptability, Scalability, MaintainabilityAdaptability, Scalability, Maintainability Abstraction, Loose coupling, Asynchrony, AgilityAbstraction, Loose coupling, Asynchrony, Agility

Standard-based Standard-based solutionsolution UbiquitousUbiquitous services via the Web services via the Web Clean division between production and Clean division between production and

delivery of servicedelivery of service

Page 19: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 19 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Main Elements in Web ServicesMain Elements in Web Services An An agentagent is a program acting on behalf of person or is a program acting on behalf of person or

organization; implements a Web serviceorganization; implements a Web service A A provider entityprovider entity is the person or organization that is the person or organization that

provides an appropriate agentprovides an appropriate agent to implement a service to implement a service A A requester entityrequester entity is a person or organization that is a person or organization that

wishes to make use of a provider entity's Web servicewishes to make use of a provider entity's Web service A A Web Services descriptionWeb Services description is a machine- is a machine-

processable specification of the processable specification of the Web service's Web service's interfaceinterface, written in WSDL, written in WSDL

The The semanticssemantics of a Web service is the of a Web service is the shared shared expectation about the behaviorexpectation about the behavior of the service (the of the service (the "contract" between the requester and the provider) "contract" between the requester and the provider)

http://www.w3.org/TR/ws-arch/

Page 20: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 20 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Engaging a Web Service Engaging a Web Service

http://www.w3.org/TR/ws-arch/

Page 21: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 21 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

RPC (Remote Procedure Call)RPC (Remote Procedure Call) A method by which a client can invoke a procedure A method by which a client can invoke a procedure

on a remote server as if it were running on the clienton a remote server as if it were running on the client Sun popularized RPCs in the 1980s for its Unix Sun popularized RPCs in the 1980s for its Unix

systemssystems

1.1. A client process, known as a A client process, known as a client stubclient stub, converts a , converts a request from a local application into a common data request from a local application into a common data formatformat

2.2. The request is then transported across a network to The request is then transported across a network to a a server stubserver stub

3.3. The server stub The server stub translates the requesttranslates the request into a form into a form the server process can understandthe server process can understand

4.4. Once the server process processes the request, the Once the server process processes the request, the procedure is reversedprocedure is reversed http://www.nwfusion.com/details/783.html

Page 22: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 22 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

RPC ModelRPC Model

Client ProcessClient Process

Client Client RoutinesRoutines

Client Client StubStub

Network Network RoutinesRoutines

(1)(1)

(2)(2)

(10)(10)

(9)(9)

Server ProcessServer Process

Server Server RoutinesRoutines

Server Server StubStub

Network Network RoutinesRoutines

(6)(6)

(7)(7)

(5)(5)

(4)(4)

(3)(3)

(8)(8)

MarshallingMarshallingUn-Un-

marshallingmarshalling

Page 23: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 23 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

RPC ExamplesRPC Examples

SunPRCSunPRC Use of the Use of the XDR (External Data Representation)XDR (External Data Representation)

standard for describing message formatsstandard for describing message formats Java RMI (Remote Method Invocation)Java RMI (Remote Method Invocation)

Use of Use of Java interfacesJava interfaces for describing message for describing message formatsformats

Use of the Use of the Java object serializationJava object serialization for data for data transmissiontransmission

Web ServicesWeb Services Use an Use an XML-based mechanism (SOAP)XML-based mechanism (SOAP) for for

describing message formatsdescribing message formats

Page 24: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 24 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Web Services and RPCWeb Services and RPC

Web Services use an Web Services use an XML-based RPCXML-based RPC mechanism (called SOAP)mechanism (called SOAP)

Page 25: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 25 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Web Services StandardsWeb Services Standards WSDLWSDL (Web Services Description Language) (Web Services Description Language)

Language for Describing Functionality and I/O Data of Language for Describing Functionality and I/O Data of Web ServicesWeb Services

DAML-SDAML-S (DARPA Agent Markup Language for (DARPA Agent Markup Language for Services)Services) Language for Describing Semantic Web ServicesLanguage for Describing Semantic Web Services

SOAPSOAP (Simple Object Access Protocol) (Simple Object Access Protocol) Envelop for sending messagesEnvelop for sending messages

UDDIUDDI (Universal Description Discovery and (Universal Description Discovery and Integration)Integration) Directory service for Web ServicesDirectory service for Web Services

Page 26: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 26 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Web Services ArchitectureWeb Services Architecture

Service ConsumerService Consumer Service ProviderService Provider

Directory ServiceDirectory Service(UDDI)(UDDI)

SOAP MessageSOAP Message(Service Description in (Service Description in WSDL)WSDL)

11SOAP MessageSOAP Message

(Queries)(Queries)22

SOAP MessageSOAP Message(Query Response in (Query Response in WSDL)WSDL)

33

SOAP MessageSOAP Message(Service Request in WSDL)(Service Request in WSDL)

44

SOAP MessageSOAP Message(Service Response)(Service Response)

55

Page 27: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 27 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

SOAPSOAP Provides a standard, extensible, composable Provides a standard, extensible, composable

framework for framework for packaging and exchangingpackaging and exchanging XML XML messagesmessages

Service Oriented Architecture ProtocolService Oriented Architecture Protocol:: Represents the information needed to Represents the information needed to invoke a serviceinvoke a service or or

reflect the resultsreflect the results of a service invocation of a service invocation Contains the information specified in the service interface Contains the information specified in the service interface

definitiondefinition Simple Object Access ProtocolSimple Object Access Protocol::

Represents a Represents a method invocationmethod invocation on a remote object on a remote object Represents the Represents the serialization of in the argument listserialization of in the argument list of that of that

method that must be moved from the local environment to method that must be moved from the local environment to the remote environment the remote environment

http://www.w3.org/TR/ws-arch/

Page 28: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 28 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

SOAP ElementsSOAP Elements

A required A required EnvelopeEnvelope element that identifies element that identifies the XML document as a SOAP message the XML document as a SOAP message

An optional An optional HeaderHeader element that contains element that contains header information header information

A required A required BodyBody element that contains element that contains call call and response informationand response information

An optional An optional FaultFault element that provides element that provides information about errors that occurred while information about errors that occurred while processing the message processing the message

http://www.w3schools.com/soap/

Page 29: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 29 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Skeleton SOAP Message Skeleton SOAP Message <?xml version="1.0"?><?xml version="1.0"?><soap:<soap:EnvelopeEnvelope

xmlns:soap="xmlns:soap="http://www.w3.org/2001/12/soap-envelopehttp://www.w3.org/2001/12/soap-envelope""soap:encodingStyle="soap:encodingStyle="http://www.w3.org/2001/12/soap-encodinghttp://www.w3.org/2001/12/soap-encoding">"><soap:<soap:Header>Header>

......</soap:Header></soap:Header><soap:<soap:Body>Body>

......<soap:<soap:Fault>Fault>

...... </soap:Fault></soap:Fault>

</soap:Body></soap:Body></soap:Envelope></soap:Envelope> http://www.w3schools.com/soap/

Page 30: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 30 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

SOAP Example SOAP Example –– Service RequestService Request

<?xml version="1.0" encoding="UTF-8"?><?xml version="1.0" encoding="UTF-8"?><soap:Envelope <soap:Envelope

xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body><soap:Body> <gs:<gs:doGoogleSearchdoGoogleSearch xmlns:gs=" xmlns:gs="urn:GoogleSearchurn:GoogleSearch">"> <key><key>X1lNZX1lNZ……………………………………+Y9j+Y9j</key></key> <q><q>wwwwww</q></q> <start><start>00</start></start> <maxResults><maxResults>1010</maxResults></maxResults> <filter><filter>truetrue</filter></filter> <restrict/><restrict/> <safeSearch><safeSearch>falsefalse</safeSearch></safeSearch> <lr><lr>lang_kolang_ko</lr></lr> <ie><ie>latin1latin1</ie></ie> <oe><oe>latin1latin1</oe></oe> </gs:doGoogleSearch></gs:doGoogleSearch> </soap:Body></soap:Body></soap:Envelope></soap:Envelope>

A SOAP message A SOAP message for accessing the for accessing the Google Web ServiceGoogle Web Servicehttp://www.google.com/apis/

Page 31: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 31 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Web Service Request via HTTPWeb Service Request via HTTPCC:\>:\>telnet api.google.com 80telnet api.google.com 80

POST /search/beta2 HTTP/1.0POST /search/beta2 HTTP/1.0Host: api.google.comHost: api.google.comAccept: text/*Accept: text/*Content-type: text/xmlContent-type: text/xmlSOAPAction: urn:GoogleSearchActionSOAPAction: urn:GoogleSearchActionContent-length: 408Content-length: 408

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><gs:doGoogleSearch xmlns:gs="urn:GoogleSearch"><key>X1lN<gs:doGoogleSearch xmlns:gs="urn:GoogleSearch"><key>X1lN… .. .. .. … .. .. .. Y9j</key><q>www</q><start>0</start><maxResults>10</maxResults><fY9j</key><q>www</q><start>0</start><maxResults>10</maxResults><filter>true</filter><restrict/><safeSearch>false</safeSearch><lr/ilter>true</filter><restrict/><safeSearch>false</safeSearch><lr/><ie>latin1</ie><oe>latin1</oe></gs:doGoogleSearch></soap:Body></><ie>latin1</ie><oe>latin1</oe></gs:doGoogleSearch></soap:Body></soap:Envelope>soap:Envelope>

Page 32: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 32 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

SOAP Example SOAP Example –– Service ResponseService Response

<?xml version='1.0' encoding='UTF-8'?><?xml version='1.0' encoding='UTF-8'?>

<SOAP-ENV:<SOAP-ENV:EnvelopeEnvelope

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">xmlns:xsd="http://www.w3.org/1999/XMLSchema">

<SOAP-ENV:<SOAP-ENV:BodyBody>>

<ns1:<ns1:doGoogleSearchResponsedoGoogleSearchResponse xmlns:ns1=" xmlns:ns1="urn:GoogleSearchurn:GoogleSearch""

SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

<<returnreturn xsi:type="ns1:GoogleSearchResult"> xsi:type="ns1:GoogleSearchResult">

<<documentFilteringdocumentFiltering xsi:type="xsd:boolean">false</documentFiltering> xsi:type="xsd:boolean">false</documentFiltering>

<<endIndexendIndex xsi:type="xsd:int">10</endIndex> xsi:type="xsd:int">10</endIndex>

<<estimateIsExactestimateIsExact xsi:type="xsd:boolean">false</estimateIsExact> xsi:type="xsd:boolean">false</estimateIsExact>

<<estimatedTotalResultsCountestimatedTotalResultsCount xsi:type="xsd:int">762000000</estimatedTotalResultsCount>xsi:type="xsd:int">762000000</estimatedTotalResultsCount>

……

Result headerResult header

Page 33: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 33 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

SOAP Example SOAP Example –– Service ResponseService Response

<<resultElementsresultElements xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/"xsi:type="ns3:Array" ns3:arrayType="ns1:ResultElement[10]">xsi:type="ns3:Array" ns3:arrayType="ns1:ResultElement[10]">

<<itemitem xsi:type="ns1:ResultElement"> xsi:type="ns1:ResultElement"> <<URLURL xsi:type="xsd:string">http://www.yahoo.com/</URL> xsi:type="xsd:string">http://www.yahoo.com/</URL> <<cachedSizecachedSize xsi:type="xsd:string"> xsi:type="xsd:string">32k32k</cachedSize></cachedSize> <<directoryCategorydirectoryCategory xsi:type="ns1:DirectoryCategory"> xsi:type="ns1:DirectoryCategory"> <<fullViewableNamefullViewableName xsi:type="xsd:string"> xsi:type="xsd:string">

Top/Computers/Internet/Searching/Directories/YahooTop/Computers/Internet/Searching/Directories/Yahoo</fullViewableName></fullViewableName> <<specialEncodingspecialEncoding xsi:type="xsd:string"></specialEncoding> xsi:type="xsd:string"></specialEncoding> </directoryCategory></directoryCategory> <<directoryTitledirectoryTitle xsi:type="xsd:string"> xsi:type="xsd:string">Yahoo!Yahoo!</directoryTitle></directoryTitle> <<hostNamehostName xsi:type="xsd:string"></hostName> xsi:type="xsd:string"></hostName> <<relatedInformationPresentrelatedInformationPresent xsi:type="xsd:boolean">true</relatedInformationPresent> xsi:type="xsd:boolean">true</relatedInformationPresent> <<snippetsnippet xsi:type="xsd:string"> xsi:type="xsd:string">... Business ... Business … … Media Newspapers, TV, Radio... Media Newspapers, TV, Radio...

</snippet></snippet> <<summarysummary xsi:type="xsd:string"> xsi:type="xsd:string">The first large scale directory of the The first large scale directory of the

Internet...Internet...</summary></summary> <<titletitle xsi:type="xsd:string"> xsi:type="xsd:string">Yahoo!Yahoo!</title></title></item> </item> ……

Web page Web page listinglisting

Page 34: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 34 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

WSDLWSDL Web Services Description LanguageWeb Services Description Language An XML-based language for describing Web An XML-based language for describing Web

servicesservices Submitted as a W3C Note by Submitted as a W3C Note by AribaAriba, , IBMIBM and and

MicrosoftMicrosoft for the W3C XML Activity in March 2001 for the W3C XML Activity in March 2001 Defines the Defines the message formatsmessage formats, , datatypesdatatypes, , transport transport

protocolsprotocols, and , and transport serialization formatstransport serialization formats that that should be used between the requester agent and should be used between the requester agent and the provider agentthe provider agent

Represents an agreementRepresents an agreement governing the governing the mechanics of interacting with that servicemechanics of interacting with that servicehttp://www.w3.org/TR/ws-arch/

Page 35: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 35 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

WSDL Description LevelsWSDL Description Levels Abstract-level DescriptionsAbstract-level Descriptions: describe a Web service in : describe a Web service in

terms of the terms of the messages it sends and receivesmessages it sends and receives An An operationoperation associates a message exchange pattern with one or associates a message exchange pattern with one or

more messagesmore messages A A message exchange patternmessage exchange pattern identifies the identifies the sequencesequence and and

cardinalitycardinality of messages sent and/or received as well as of messages sent and/or received as well as whowho they they are logically sent to and/or received fromare logically sent to and/or received from

An An interfaceinterface groups together operations without any commitment to groups together operations without any commitment to transport or wire formattransport or wire format

Concrete-level DescriptionsConcrete-level Descriptions:: A A bindingbinding specifies specifies transport and wire format detailstransport and wire format details for one or for one or

more interfacesmore interfaces An An endpointendpoint associates a network address with a binding associates a network address with a binding A A serviceservice groups groups together endpoints that implement a common together endpoints that implement a common

interface interface http://www.w3.org/TR/wsdl20/

Page 36: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 36 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

WSDL Document StructureWSDL Document Structure

Main Elements:Main Elements: <portType><portType> The The operationsoperations performed by the web service performed by the web service <message><message> The messages used by the web service The messages used by the web service <types><types> The The data typesdata types used by the web service used by the web service <binding><binding> The communication The communication protocolsprotocols used by the web used by the web

serviceservice Skeleton WSDL Document:Skeleton WSDL Document:

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

Page 37: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 37 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

WSDL ExampleWSDL Example

<definitions><definitions> <message<message name=" name="getTermRequestgetTermRequest">"> <part name="<part name="termterm" type="xs:string"/>" type="xs:string"/> </message></message> <message<message name=" name="getTermResponsegetTermResponse">"> <part name="<part name="valuevalue" type="xs:string"/>" type="xs:string"/> </message></message> <portType<portType name=" name="glossaryTermsglossaryTerms">">

<operation<operation name=" name="getTermgetTerm">"><input<input message=" message="getTermRequestgetTermRequest"/> "/> <output<output message=" message="getTermResponsegetTermResponse"/> "/>

</operation></operation> </portType></portType></definitions></definitions>

Page 38: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 38 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

WSDL Example WSDL Example (cont.)(cont.)

<binding<binding type=" type="glossaryTermsglossaryTerms" name="b1">" name="b1"> <soap:binding<soap:binding style=" style="documentdocument"" transport="http://schemas.xmlsoap.org/soap/http"/>transport="http://schemas.xmlsoap.org/soap/http"/> <operation><operation> <soap:operation<soap:operation

soapAction="soapAction="http://example.com/getTermhttp://example.com/getTerm"/>"/> <input><input> <soap:body<soap:body use="literal"/> use="literal"/> </input></input> <output><output> <soap:body<soap:body use="literal"/> use="literal"/> </output></output> </operation></operation></binding></binding>

Page 39: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 39 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Google WSDLGoogle WSDLhttp://api.google.com/GoogleSearch.wsdl

Page 40: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 40 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

WWeeb Services Examplesb Services Examples

WS Index: WS Index: http://www.wsindex.org/Web_Services/index.htmlhttp://www.wsindex.org/Web_Services/index.html

XMethods (List of publicly available Web XMethods (List of publicly available Web Services): Services): http://www.xmethods.com/http://www.xmethods.com/ Google searchGoogle search Amazon.comAmazon.com InstantMessageAlertInstantMessageAlert SendEmailSendEmail Global WeatherGlobal Weather StockQuoteStockQuote Air Fare Quote SearchAir Fare Quote Search BabelFishBabelFish ……

Page 41: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 41 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

The Problem with Web ServicesThe Problem with Web Services

How can I How can I discover business partnersdiscover business partners with with compatible web service solutions?compatible web service solutions?

How do How do let other business know aboutlet other business know about my my exposed web services?exposed web services?

Web services are great, after you find out Web services are great, after you find out about them, but the discovery process is about them, but the discovery process is difficultdifficult

http://sern.ucalgary.ca/courses/CPSC/547/W2002/slides/uddi-wsdl.ppt

Page 42: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 42 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

UDDIUDDI Universal Description, Discovery and IntegrationUniversal Description, Discovery and Integration

UDDI creates UDDI creates a standard interoperable platforma standard interoperable platform that that enables humans and applications to quickly, easily, enables humans and applications to quickly, easily, and dynamically and dynamically find and use Web servicesfind and use Web services over the over the InternetInternet

UDDI allows UDDI allows operational registriesoperational registries to be maintained to be maintained for different purposes in different contextsfor different purposes in different contexts

UDDI is a UDDI is a cross-industry effortcross-industry effort ( (UDDI.orgUDDI.org) driven by ) driven by major platform and software providers, as well as major platform and software providers, as well as marketplace operators and e-business leadersmarketplace operators and e-business leaders

http://www.uddi.org/

Page 43: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 43 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

UDDI DataUDDI Data EntitiesEntities: data structures that expressed in XML, and are : data structures that expressed in XML, and are

persistently stored by UDDI nodespersistently stored by UDDI nodes Entity Types:Entity Types:

businessEntitybusinessEntity: Describes a business or other organization that : Describes a business or other organization that typically typically provides Web servicesprovides Web services

businessServicebusinessService: Describes a collection of related : Describes a collection of related Web services Web services offered by an organizationoffered by an organization

bindingTemplatebindingTemplate: Describes the : Describes the technical informationtechnical information necessary to necessary to use a particular Web serviceuse a particular Web service

tModeltModel: Describes a “technical model” such as a Web service type, a : Describes a “technical model” such as a Web service type, a protocol, or a category systemprotocol, or a category system

publisherAssertionpublisherAssertion: Describes, the : Describes, the relationshiprelationship that the that the businessEntity has with another businessEntitybusinessEntity has with another businessEntity

subscriptionsubscription: Describes a standing request to keep track of changes : Describes a standing request to keep track of changes to the entities described by the subscriptionto the entities described by the subscription

http://www.uddi.org/

Page 44: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 44 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

UDDI Example – Data Type StructureUDDI Example – Data Type Structure

<<businessEntitybusinessEntity businessKeybusinessKey="35AF7="35AF7…..…..ACDD"ACDD"authorizedNameauthorizedName="0100002CAL" ="0100002CAL"

operatoroperator="www-3.ibm.com/services/uddi">="www-3.ibm.com/services/uddi"><<namename>BooksToGo</name>>BooksToGo</name><<descriptiondescription xml:lang="en"> xml:lang="en">

The source for all professional booksThe source for all professional books</description></description><<contactscontacts>>

<contact><contact><personName>Ramesh Mandava</personName><personName>Ramesh Mandava</personName><phone>(877)1111111</phone><phone>(877)1111111</phone>

</contact></contact></contacts></contacts>

</businessEntity></businessEntity>

Taken from http://developer.java.sun.com/developer/technicalArticles/WebServices/WSPack/

Page 45: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 45 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Access UDDI via API’sAccess UDDI via API’s

SOAP and XML Schema are the basisSOAP and XML Schema are the basis

User UDDI

SOAP Request

UDDISOAP Response

UDDI RegistryNode

HTTPServer

SOAPProcessor

UDDIRegistry Service

B2B DirectoryCreate, View, Update, and Deleteregistrations Implementation-

neutral

© Copyright 2000 By Ariba, Inc., International Business Machines Corporation and Microsoft Corporation. All Rights Reserved.

Page 46: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 46 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Web Services StackWeb Services Stack

http://www-306.ibm.com/software/solutions/webservices/pdf/WSCA.pdf

Page 47: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 47 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Web Services PlatformsWeb Services Platforms

Provides facilities to support Web Services-Provides facilities to support Web Services-related activitiesrelated activities Service Description Service Description Service Implementation Service Implementation Service Publishing, Discovery and Binding Service Publishing, Discovery and Binding Service Invocation and ExecutionService Invocation and Execution

ExamplesExamples Microsoft .NETMicrosoft .NET IBM’s WebSphereIBM’s WebSphere Sun’s J2EE (Sun’s J2EE (Java 2 Platform, Enterprise Edition)Java 2 Platform, Enterprise Edition)

http://www.webservicesarchitect.com/content/articles/hanson01.asp

Page 48: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 48 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Web Services ReferencesWeb Services References

W3C Web Services page: W3C Web Services page: http://www.w3.org/2002/ws/http://www.w3.org/2002/ws/

Web Services Architecture: Web Services Architecture: http://www.w3.org/TR/ws-arch/http://www.w3.org/TR/ws-arch/

Web Services Conceptual Architecture: Web Services Conceptual Architecture: http://www-http://www-306.ibm.com/software/solutions/webservices/pdf/WSCA.pdf306.ibm.com/software/solutions/webservices/pdf/WSCA.pdf

Web Services Description Language (WSDL): Web Services Description Language (WSDL): http://www.w3.org/TR/wsdl20/http://www.w3.org/TR/wsdl20/

WSDL Tutorial: WSDL Tutorial: http://www.w3schools.com/wsdl/default.asphttp://www.w3schools.com/wsdl/default.asp

SOAP Tutorial: SOAP Tutorial: http://www.w3schools.com/soap/default.asphttp://www.w3schools.com/soap/default.asp

SOAP Primer: SOAP Primer: http://www.w3.org/TR/soap12-part0/http://www.w3.org/TR/soap12-part0/

Page 49: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 49 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Web Services References Web Services References (cont.)(cont.)

UDDI Technical White Paper: UDDI Technical White Paper: http://www.uddi.org/pubs/Iru_UDDI_Technical_White_Paper.pdfhttp://www.uddi.org/pubs/Iru_UDDI_Technical_White_Paper.pdf

UDDI Spec Technical Committee Specification: UDDI Spec Technical Committee Specification: http://uddi.org/pubs/uddi-v3.0.1-20031014.htmhttp://uddi.org/pubs/uddi-v3.0.1-20031014.htm

The Java Web Services Tutorial: The Java Web Services Tutorial: http://java.sun.com/webservices/docs/1.0/tutorial/http://java.sun.com/webservices/docs/1.0/tutorial/

Microsoft .NET - Microsoft .NET - http://www.microsoft.com/net/http://www.microsoft.com/net/

IBM’s WebSphere - IBM’s WebSphere - http://www.ibm.com/software/info1/websphere/index.jsphttp://www.ibm.com/software/info1/websphere/index.jsp

Sun’s J2EE (Sun’s J2EE (Java 2 Platform, Enterprise Java 2 Platform, Enterprise Edition) - Edition) - http://java.sun.com/j2ee/http://java.sun.com/j2ee/

Page 50: Programming for WWW (ICE 1338) Lecture #12 Lecture #12 August 4, 2004 In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT.

August 4, 2004 50 Programming for WWW (Lecture#12) In-Young Ko, Information Communications University

Reading Assignment #3Reading Assignment #3

Web Services Conceptual ArchitectureWeb Services Conceptual Architecture, , Heather Creger, IBMHeather Creger, IBMhttp://www-306.ibm.com/software/solutions/webservices/pdf/WSCA.pdfhttp://www-306.ibm.com/software/solutions/webservices/pdf/WSCA.pdf