Académique Documents
Professionnel Documents
Culture Documents
Basicinfo
Webpages: http://www.systems.ethz.ch/education/courses/fs10/webservicesandsoa Thisiswhereallthelecturematerialsandadditionalpointerscanbefound Exam:Lastweekofthesemester duringthelecturehours Exercises: Exercisesaremandatoryandarequirementtodotheexam PleaseregisterassoonaspossibleineDoz Course(tentative): Wesservicebasics SOAP WSDL UDDI Composition&BPEL Messaging Web2.0 REST SOAandintegrationarchitectures Presentationsfromindustry
2
TheWebassoftwarelayer(Ntier)
Browser
Web Server
app server 1
app server 1
MIDDLEWARE
Front end
Ntierarchitecturesresultfrom connectingseveralthreetiersystems toeachotherand/orbyaddingan additionallayertoallowclientsto accessthesystemthroughaWeb server TheWeblayerwasinitiallyexternalto thesystem(atrueadditionallayer); today,itisslowlybeingincorporated intoapresentationlayerthatresides ontheserverside(partofthe middlewareinfrastructureinathree tiersystem,orpartoftheserver directlyinatwotiersystem) TheadditionoftheWeblayerledto thenotionofapplicationservers, whichwasusedtorefertomiddleware platformssupportingaccessthrough theWeb
user program
user program
user program
user program
WWWbasics
Theearliestimplementations wereverysimpleandbuilt directlyupontheexistingsystems (client/serverbasedonRPC,TP Monitors,oranyotherformof middlewarewhichallowed interactionthrougha programmableclient) theCGIscript(orprogram) actedasclientinthe traditionalsense(forinstance usingRPC) theuserclickedinagivenURL andtheserverinvokedthe correspondingscript thescriptexecuted,produced theresultsandpassedthem backtotheserver(usuallyas theaddressofawebpage) theserverretrievedthepage andsendittothebrowser
BROWSER URL response page WEB SERVER map URL to CGI script execute CGI script get results back (stdout of CGI script) prepare response page send page to browser Implemented as a normal client CGI script INTERNET
Appletsandclients
Theproblemoftheusingaweb browserasuniversalclientisthatit doesnotdomuchbeyonddisplaying data(itisathinclient): multipleinteractionsareneeded tocompletecomplexoperations thesameoperationsmustbe doneoverandoveragainforall clients theprocessingpowerattheclient isnotused ByaddingaJVM(JavaVirtual Machine)tothebrowser,nowit becomespossibletodynamically downloadtheclientfunctionality(an applet)everytimeitisneeded Theclientbecomestrulyindependent oftheoperatingsystemandisalways underthecontroloftheserver
WEB SERVER
Front end
app server 1
app server 1
MIDDLEWARE
5
user program
user program
user program
user program
WebserverasaclientofaEAIsystem
CGIscriptswereinitiallywidelyused astherewasnootherwayof connectingthewebserverwiththeIT systemsothatitcoulddosomething beyondsendingstaticdocuments However,CGIscriptshaveseveral problemsthatarenoteasytosolve: CGIscriptsareseparate processes,requiringadditional contextswitcheswhenacallis made(andtherebyaddingtothe overalldelay) FastCGIallowscallstobemade toasinglerunningprocessbutit stillrequirestwocontext switches CGIisreallyaquickhacknot designedforperformance, security,scalability,etc.
Request 1
Request 2 Web server process Normal CGI calls CGI script child process 2
Request 1
Request 2
Servlets
Call servlets Servlet child thread 2 Servlet child thread 1 Call to underlying middleware
threads
ServletsfulfillthesameroleasCGI scripts:theyprovideawayto invokeaprograminresponseto anhttprequest. However: Servletsrunasthreadsofthe Javaserverprocess(not necessarilythewebserver) notasseparateOSprocesses unlikeCGIscripts,thatcanbe writteninanylanguage, Servletsarealwayswrittenin Java(andare,therefore, portable) canuseallthemechanisms providedbytheJVMfor securitypurposes
Request 1
ServletsandHTML
HTML request includes < SERVLET NAME=MyServlet> < PARAM NAME=param1 VALUE=val1> < PARAM NAME=param2 VALUE=val2> ... < /SERVLET>
Servlet code import java.servlet.*; public class MyServlet extends GenericServlet { public void service ( ServletRequest request, ServletResponse response ) throws ServletException, IOException { ... } ... }
Gustavo Alonso, D-INFK. ETH Zrich.
HTML document
Justonemorelayer...
BROWSER Internet SALES POINT CLIENT IF no_customer_# THEN New_customer ELSE Lookup_customer Check_inventory IF enough_supplies THEN Place_order ELSE ... Server 1 New_customer Lookup_customer Delete_customer Update_customer Server 2 New_product Lookup_product Delete_product Update_product Server 3 Place_order Cancel_order Update_inventory Check_inventory RPC based system
Customer database
WEB SERVER
INVENTORY CONTROL CGI script call CLIENT Lookup_product Check_inventory IF supplies_low THEN CGI script call Place_order Update_inventory ...
Gustavo Alonso, D-INFK. ETH Zrich.
Products database
ontopofexistingsystems
TP Client
Yearly balance ?
TP Client
Monthly average revenue ?
WEB SERVER
Internet
browser
Front end
TP-Monitor environment
Control (load balancing, cc and rec., replication, distribution, scheduling, priorities, monitoring ) recoverable queue app server 3
app server 1
app server 1
app server 2
user program
user program
user program
user program
10
BusinesstoBusiness(B2B)
FIREWALL WEB SERVER
Front end
INTERNET
MIDDLEWARE
Service A
wrappers
MIDDLEWARE
11
Service B
Service 1
user program
user program
Service 2
user program
user program
user program
user program
user program
user program
LimitationsoftheWWW
HTTPwasoriginallydesignedasa documentexchangeprotocol (requestadocument,getthe document,displaythedocument). Itlackedsupportforclientside parameters Itsarchitecturewasoriginally designedwithhumanusersin mind.Thedocumentformat (HTML)wasdesignedtocope withGUIproblemsnotwith semantics.InEAI,thegoalis almostalwaystoremovehumans fromthebusinessprocesses (mostlytoreducecostsandto speedtheprocessup).Strict formattingrulesandtaggingare keytoexchangingmessages acrossheterogeneoussystems
Interactionthroughdocument exchangecanbeveryinefficient whenthetwosidesofthe interactionareprograms (documentsmustbecreated,sent, parsedonarrival,information extracted,etc.).Unfortunately, httpdoesnotdirectlysupportany otherformofinteraction TheinitialWWWmodelwas heavilybiasedtowardstheserver side:theclient(thebrowser)does notdomuchbeyonddisplaying thedocument.Forcomplex applicationsthatmeant muchmoretrafficbetween clientandserver highloadsattheserverasthe numberofusersincreases
12
HTTPasacommunicationprotocol
Information about the environment where the browser is running E-mail or identifier of the user (provided by the browser) End of request
13
HTTPserverside
Document sent
14
Parameterpassing
POST request indicating the CGI script to execute (post-query) GET can be used but requires the parameters to be sent as part of the URL: /cgi-bin/post-query?name=&email=...
As before
...
Data provided through the form and sent back to the server
15
ChallengesofB2B
ThebasicideabehindB2Bis simpleandfollowsthe client/servermodel.Aservice providedbyonecompanycanbe directlyinvokedbyaclient runninginanothercompany.That way,theinteractionsbetweenthe companiesareautomatedand theirITsystemscandirectly interactwitheachother,thereby speedingupaltransactions betweenbothcompanies. TherearemanyexamplesofB2B interactions.Themostbasiconeis apurchaseorder wherebya companydirectlyplacesanorder withanothercompany.Ifdone correctly,eventhisbasic interactioncanbecomeavery powerfuladvantagefora company.
Theproblemishowtoimplement suchasystem: theclientisnolongernearthe server jointdevelopmentofclient andservermakesnosense theserverandclientarelikely tobehiddenbehindfirewalls theinteractiontakesplace amongexistingsystems,itis notpossibletohomogenize thesupportingplatforms theInternetischeapbutopen toeverybody(unlikeleased linesthatareexpensivebut private) Existingsystems/protocolsare notreallydesignedforsuchtype ofinteractions
16
Contentsandpresentation
HTMLisataglanguagedesignedto describehowadocumentshouldbe displayed(thevisualformatofthe document). HTMLisoneofthemanytag languagesthatexist,someofthem havingbeinginusebeforeHTMLeven existed Taglanguageshavebeendeveloped andareusedinmanyindustries (aircraftmanufacturing, semiconductors,computermanuals). Taglanguagesprovideastandardized grammardefiningthemeaningoftags andtheiruse TaglanguagesuseSGML,an internationaltextprocessingstandard fromthe80s,todefinetagsetsand grammars
<h2>Table of contents</h2><a name=TOC></a> <ul> <li><a href="SG.htm">1 A Gentle Introduction to SGML</a></li> <li><a href="SG11.htm">2 What's Special about SGML? </a></li> <ul> <li><a href="SG11.htm#SG111">2.1 Descriptive Markup</a></li> <li><a href="SG11.htm#SG112">2.2 Types of Document</a></li> <li><a href="SG11.htm#SG113">2.3 Data Independence </a></li> </ul> <li><a href="SG12.htm">3 Textual Structure</a></li> <li><a href="SG13.htm">4 SGML Structures</a></li> <ul> <li><a href="SG13.htm#SG131">4.1 Elements</a></li> <li><a href="SG13.htm#SG132">4.2 Content Models: An Example</a></li> </ul>
17
HTMLandXML
HTMLonlyprovidesprimitivesfor formattingadocumentwithahuman userinmind UsingHTMLthereisnowayto indicatewhatarethecontentsofa document(itssemantics) Forinstance,aquerytoAmazon.com returnsabookanditspriceasan HTMLdocument ahumanhasnoproblem interpretingthisinformationonce thebrowserdisplaysit toparsethedocumentto automaticallyidentifythepriceof thebookismuchmore complicatedandanadhoc procedure(differentforevery bookstore)
B2Bapplicationsrequiredocuments thataremuchmorestructuredsothat theycanbeeasilyparsedandthe informationtheycontainextracted Tocopewiththisrequirement,the XMLstandardwasproposed ImportantaspectsofXML: XMLisnotanextensiontoHTML XMLisaversionofSGMLthatcan beimplementedinaWeb browser XMLisnotalanguagebuta metalanguage usedtodefine markuplanguages XMLtagshavenostandard meaningthatcanbeinterpreted bythebrowser.Themeaning mustbesuppliedasanadditionin theformofastylesheetor program
18
DatastructuresinXML
Mouse Bovine Gibbon Orang Gorilla Human Chimp
('Mouse':0.792449, (((('Human':0.105614, 'Chimp':0.171597 ):0.074558, 'Gorilla':0.152701 ):0.048980, 'Orang':0.303652 ):0.121196, 'Gibbon':0.336296 ):0.485445, 'Bovine':0.902183 ):0.0;
<?xml version="1.0" ?> <!DOCTYPE trees SYSTEM "treefile.dtd"> <trees> <tree> <branch> <node> <specie> 'Mouse' </specie> </node> <length> 0.792449 </length> </branch> <branch> <node> <branch> <node> <branch> <node> <branch> <node> <branch> <node> <specie> 'Human' </specie> </node> ... </tree> </trees>
<!ELEMENT trees (tree+)> <!ELEMENT tree (branch,branch,branch?,length?)> <!ELEMENT branch (node,length?)> <!ELEMENT node ((branch,branch)|specie)> <!ELEMENT length (#PCDATA)> <!ELEMENT specie (#PCDATA)> DTD DTD File File
Gustavo Alonso, D-INFK. ETH Zrich.
19
DTDsanddocuments
ThegoalofXMListoprovidea standardizedwaytospecifydata structuressothatwhendatais exchanged,itispossibleto understandwhathasbeensent TheDocumentTypeDefinition(DTD) specifieshowthedatastructureis described:processinginstructions, declarations,comments,andelements UsingtheDTD,theXMLdocumentcan becorrectlyinterpretedbyaprogram bysimplyparsingthedocumentusing thegrammarprovidedbytheDTD TheideaissimilartoIDLexceptthat insteadofdefiningparametersas combinationsofstandardtypes,a DTDdescribesarbitrarydocumentsas semistructureddata
UsingXMLispossibletoexchange datathroughHTTPandWebservers andprocessthedataautomatically NotethattheuseofXMLreducesthe universalityofthebrowsersincenow abrowserneedsadditionalprograms todealwithspecificmarkup languagesdevelopedusingXML (somewhatsimilartopluginsbut moreencompassingintermsof functionality) However,thisisnotmuchofa problemsincethebrowserisfor humanswhileXMLisforautomated processing XMLcanbeusedastheintermediate languageformarshalling/serializing argumentswheninvokingservices acrosstheInternet
20
Webservices
CLIENT call stubs, runtime service location SOAP system
Serialized XML doc Wrap doc in HTTP POST request
SERVER service
SOAP system
Serialized XML doc
INTERNET
WebServicesArchitecture
1. 2.
3.
ApopularinterpretationofWeb servicesisbasedonIBMsWeb servicearchitecture basedonthree elements: Servicerequester:Thepotential userofaservice(theclient) Serviceprovider:Theentitythat implementstheserviceandoffers tocarryitoutonbehalfofthe requester(theserver) Serviceregistry:Aplacewhere availableservicesarelistedand thatallowsproviderstoadvertise theirservicesandrequestersto lookupandqueryforservices
22
MainWebServicesStandards
TheWebservicearchitecture proposedbyIBMisbasedontwo keyconcepts: architectureofexisting synchronousmiddleware platforms currentspecificationsof SOAP,UDDIandWSDL Thearchitecturehasaremarkable client/serverflavor Itreflectsonlywhatcanbedone with SOAP(SimpleObjectAccess Protocol) UDDI(UniversalDescription andDiscoveryProtocol) WSDL(WebServices DescriptionLanguage)
UDDI
SOAP
WSDL
Gustavo Alonso, D-INFK. ETH Zrich. 23
TheServiceBus
Service Bus
24
BenefitsofWebservices
Oneimportantdifferencewithconventionalmiddlewareis relatedtothestandardizationeffortsattheW3Cthatshould guarantee: Platformindependence (Hardware,OperatingSystem) Reuseofexistingnetworkinginfrastructure (HTTPhasbecomeubiquitous) Programminglanguageneutrality (.NETtalkswithJava,andviceversa) PortabilityacrossMiddlewaretoolsofdifferentVendors Webservicesarelooselycoupled componentsthatfoster softwarereuse WStechnologiesshouldbecomposable sothattheycanbe adoptedincrementally
25
WSStandardsandSpecifications
Transport Messaging Description Discovery Choreography Business Processes Stateful Resources Transactions Reliable Messaging Security Event Notification Management Data Access
GustavoAlonso,DINFK.ETHZrich.
HTTP, IIOP, SMTP, JMS XML, SOAP WS-Addressing XML Schema, WSDL WS-Policy, SSDL WS-MetadataExchange UDDI WSCL WSCI WS-Coordination BPML WSCDL WS-BPEL WS-Resource Framework WS-CAF WS-Reliability WS-Security SAML, XACML WS-Notification WSDM OGSA-DAI WS-Transactions WS-Business Activities WS-ReliableMessaging WS-Trust, WS-Privacy WS-SecureConversation WS-Eventing WS-Management SDO
26
WhatisSOA
SOA=ServicesOrientedArchitecture Services =anothernameforlargescalecomponents wrappedbehindastandardinterface(Webservices althoughnotonly) Architecture =SOAisintendedasawaytobuild applicationsandfollowsonpreviousideassuchas softwarebus,ITbackbone,orenterprisebus Thepartthatitisnotinthename Looselycoupled =theservicesareindependentofeach other,heterogeneous,distributed Messagebased =interactionisthroughmessageexchanges ratherthanthroughdirectcalls(unlikeWebservices, CORBA,RPC,etc.)
27
ThenoveltybehindSOA
TheconceptofSOAisnotnew: Messageorientedmiddleware Messagebrokers Eventbasedarchitectures Thecurrentcontextisdifferent Emergenceofstandardinterfaces(Webservices) Emphasisonsimplifyingdevelopment(automatic) Useofcomplexunderlyinginfrastructure(containers, middlewarestacks,etc.) InterestinSOAarisesfromanumberofreasons: Basictechnologyinplace Moreclearunderstandingofdistributedapplications Thekeyproblemisintegrationnotprogramming
28
TheneedforSOA
Mostcompaniestodayhavealarge,heterogeneousITinfrastructurethat: Keepschanging Needstoevolvetoadoptnewtechnology Needstobeconnectedofthatofcommercialpartners Needstosupportanincreasingamountofpurposesandgoals ThiswasthefieldofEnterpriseApplicationIntegrationusingsystemslikeCORBAor DCOM.However,solutionsuntilnowsufferedfrom: Tightlyintegratedsystems Vendorlockin(e.g.,vendorstacks) Technologylockin(e.g.,CORBA) Lackofflexibilityandlimitationswhennewtechnologyarises(e.g.,Internet) SOAisanattempttobuildonstandards(webservices)toreduce thecostof integration Itintroducesveryinterestingpossibilities: Developmentbycomposition Largescalereuse Freesdevelopersfromlockin effectsofvariouskinds
29
SOAvs.Webservices
Webservicesareabout Interoperability Standardization Integrationacrossheterogeneous,distributedsystems ServiceOrientedArchitecturesareabout: Largescalesoftwaredesign SoftwareEngineering Architectureofdistributedsystems SOAispossiblebutmoredifficultwithoutWebservices SOAintroducessomeradicalchangestosoftware: Languageindependence(whatmattersistheinterface) Eventbasedinteraction(nolongersynchronousmodels) Messagebasedexchanges(noRPC) Compositionandorchestration
30
SOAandwebservices
Thereisnoprobleminsystem design thatcannotbesolved byaddingalevelofindirection. Thereisnoperformance problemthatcannotbesolved byremovingalevelof indirection.
WSInvocationFramework UseWSDLtodescribeaservice UseWSIFtoletthesystemdecide whattodowhentheserviceis invoked: IfthecallistoalocalEJBthen donothing IfthecallistoaremoteEJB thenuseRMI Ifthecallistoaqueuethen useJMS IfthecallistoaremoteWeb servicethenuseSOAPand XML Thereisasingleinterface description,thesystemdecides onthebinding Thistypeoffunctionalityisatthe coreofthenotionofService OrientedArchitecture
31