Download
bp1070 web services a technical overview n.
Skip this Video
Loading SlideShow in 5 Seconds..
BP1070: Web Services – A Technical Overview PowerPoint Presentation
Download Presentation
BP1070: Web Services – A Technical Overview

BP1070: Web Services – A Technical Overview

378 Vues Download Presentation
Télécharger la présentation

BP1070: Web Services – A Technical Overview

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. BP1070:Web Services – A Technical Overview Ken Wilner (wilner@progress.com) Fellow

  2. Agenda Web Services Architecture Wire Stack Description Stack Discovery Stack That’s All Folks…

  3. What Is a Web Service? A Web Service is a software system identified by a URI, whose public interfaces and bindings are defined and described by XML. Its definition can be discovered by other software systems. These systems may then interact with the Web Service in a manner prescribed by its definition, using XML based messages conveyed by internet protocols. Web Services ArchitectureW3C Working Draft 14 November 2002http://www.w3.org/TR/ws-arch/ What the standards guys are saying.

  4. What is a Web Service? An application that can be accessed over the Web or any network from another application using RPC style calls encoded using SOAP over HTTP where the interface is described using WSDL Ken Wilner, Fellow PSC Reality today.

  5. Service-Oriented Architecture and Web Services Web ServiceRegistry Publish, Find, and Bind Find Web Service Publish Web Service ServiceDetails Interact (Bind) Web Service Provider Web ServiceRequestor

  6. SOAP XML WSDL HTTP XML Schema Web Services Protocol Stacks Directory UDDI A Inspection Messaging Discovery Stack Data Encoding Network Protocol Service Orchestration Wire Stack Service Description Datatype Definition Description Stack

  7. Web Services Implementation Architecture Web Server ApplicationServer POST(Soap) Web Service Client HTTP Listener SOAP Processor BusinessLogic Business Interface Response(Soap) WSDL Web Service

  8. Web Server POST(Soap) Web Service Client HTTP Listener Web Services Adapter Response(Soap) AppServers WSDLFiles OpenEdge Web Services Toolkit Architecture

  9. Why Should I Care? • Understand the standards that make up Web Services • Understand the state of Web Services and where its heading • Understand how to use Web Services efficiently • Understand why Web Services will be successful and where

  10. SOAP XML HTTP Agenda Web Services Architecture Wire Stack Description Stack Discovery Stack That’s All Folks… Messaging Data Encoding Network Protocol Wire Stack

  11. What It Is…. • A lightweight xml-based protocol for message exchange • Supports message typing, strong typing, and structured data • Can be used in a variety of communication paradigms • Programming language and platform independent • Highly extensible • Transport independent • Encoding independent • Extra context via headers

  12. What It Is… • W3C Note SOAP V1.1 http://www.w3.org/TR/SOAP • SOAP message format • SOAP encoding • SOAP over HTTP transport binding • SOAP for RPC convention • W3C Draft SOAP V1.2 http://www.w3.org/TR/soap12-part0/ http://www.w3.org/TR/soap12-part1/ http://www.w3.org/TR/soap12-part2/

  13. <Body> encloses body entries <Header> encloses headers (optional) Headers entries contain extensions Message name and data SOAP Header Header Entry … Header Entry SOAP Body Body Entry SOAP Message <Envelope> encloses message SOAP Envelope

  14. SOAP Message <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope SOAP-ENV:encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Header> <hd:Security xmlns:hd="http://www.e1.com"> <username>Wilner</username> <password>BigDeal</password> </hd:Security> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:GetCustomer xmlns:ns1="http://www.e1.com"> <CustomerId xsi:type="xsd:int">6734</CustomerId> </ns1:GetCustomer> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  15. SOAP Envelope <SOAP-ENV:Envelope SOAP-ENV:encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> … </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  16. SOAP Body • Body entry contains application-specific data • Serialized based on encodingStyle • May represent an RPC request or response message, a specific document, or whatever you want

  17. SOAP Body <SOAP-ENV:Envelope … > <SOAP-ENV:Body> <ns1:GetCustomer xmlns:ns1="http://www.e1.com"> <CustomerId xsi:type="xsd:int">6734</CustomerId> </ns1:GetCustomer> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  18. SOAP Header • Allows (optional) context information to be added to message independently of the payload • Authentication and authorization information • Transaction id • Object id • Intermediary specific information – chaining • Routing information – to, from, via, etc… • Security information • Auditing

  19. SOAP Header <SOAP-ENV:Envelope … > <SOAP-ENV:Header> <hd:TID xmlns:hd="http://www.e1.com"> 673456:4439234:439439439349 </hd:TID> <hd:Securityxmlns:hd="http://www.e1.com"> <username>Wilner</username> <password>BigDeal</password> </hd:Security> </SOAP-ENV:Header> <SOAP-ENV:Body> … </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  20. Transports • HTTP • SMTP (E-Mail) • FTP • Files • Postal Service • FAX • DOG

  21. SOAP Over HTTP • As specified in SOAP V1.1 note • HTTP POST message • SOAPAction HTTP header • HTTP status code • 2xx indicates success • 500 indicates fault

  22. HTTP Header SOAP Request SOAP Over HTTP Request • POST / HTTP/1.1 • SOAPAction: "http://www.e1.com/GetCustomer" • Content-Type: text/xml; charset=utf-8 • Host: localhost:8081 • Content-length: 706 • <SOAP-ENV:Envelope … > • <SOAP-ENV:Body> • <ns1:GetCustomer • xmlns:ns1="http://www.e1.com"> • <CustomerId xsi:type="xsd:int"> • 6734 • </CustomerId> • </ns1:GetCustomer> • </SOAP-ENV:Body> • </SOAP-ENV:Envelope>

  23. HTTPResponseHeader SOAP Response SOAP Over HTTP Response • HTTP/1.1 200 OK • Content-Type: text/xml; charset=utf-8 • Content-Length: 226 • <SOAP-ENV:Envelope … > • <SOAP-ENV:Body> • <ns1:GetCustomerResponse xmlns:ns1="http://www.e1.com"> • <Name xsi:type="xsd:string"> • Fred Flintstone • </Name> • <Balance xsi:type="xsd:decimal"> • 2349.27 • </Balance> • </ns1:GetCustomerResponse> • </SOAP-ENV:Body> • </SOAP-ENV:Envelope>

  24. Attachments • Standard way of attaching or including non-XML data in a Web Services (SOAP) request, e.g. a picture, an EXCEL file, another XML document, etc. • Two Approaches • SOAP with Attachments • based on MIME with extensions to SOAP and WSDL http://www.w3.org/TR/SOAP-attachments • WS-Attachments • A Microsoft and IBM proposal • based on DIME • A more efficient version of MIME http://www-106.ibm.com/developerworks/webservices/library/ws-attach.html

  25. MIME Header SOAP Envelope MIME Part 0 SOAP Header SOAP Body MIME Part n SOAP with Attachments MIME Standard MIME header 1st MIME part containers SOAP message ... Other MIME parts container whatever you want ????????

  26. SOAP with Attachments MIME-Version : 1.0 Content Type:Multipart/Related;boundary=MIME_boundary; type=text/xml; start=56987563343@progress.com--MIME_boundary Content-Type: text/xml; charset=UTF-8Content-Transfer-Encoding: 8bitContent-Id: <56987563343@progress.com><?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/> <SOAP-ENV:Body> <ns1:GetCustomerPictureResponse xmlns:ns1="http://www.e1.com"> <Picture href="cid:56987566734@progress.com" /> </ns1:GetCustomerPictureResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  27. SOAP with Attachments --MIME_boundary Content-Type: image/tiff Content-Transfer-Encoding: binary Content-Id: <56987566734@progress.com> …binary TIFF image --MIME_boundary

  28. WSDL XML Schema Agenda Web Services Architecture Wire Stack Description Stack Discovery Stack That’s All Folks… Service Orchestration Service Description Datatype Definition Description Stack

  29. WSDL Web Service Description Language W3C note – defacto standard http://www.w3.org/TR/WSDL.html • Service interface • What can it do? • Service implementation • How do I invoke it? • Service location (optional) • Where does it reside?

  30. WSDL • Service interface maps to business interface • Generation approaches: • WSDL generated from business interface • Business interface generated from WSDL (industry standards)

  31. XML Schema part XML Schema part XML Schema part XML Schema porttype binding binding ServiceInterface operation operation operation message message message WSDL types ServiceImplementation ServiceLocation service port

  32. WSDL <definitions ….> <messages …> ... </messages> … <messages …> ... </messages> <portType …> … </portType> … <portType …> … </portType> <binding …> … </binding> <service…> … </service> </definitions>

  33. WSDL Definitions <definitions name="CustomerAdmin" targetNamespace= "http://www.example.com/customer" xmlns:tns="http://www.example.com/customer" xmlns:soap= "http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"> xmlns="http://schemas.xmlsoap.org/wsdl/" … </definitions>

  34. WSDL Messages <message name="GetCustomer"> <part name="CustomerId" type="xs:int"/> </message> <message name="GetCustomersResponse"> <part name="Name" type="xs:string"/> <part name="Balance" type="xs:decimal"/> </message>

  35. WSDL PortType <portType name="CustomerPortType"> <operation name="GetCustomer"> <input message="tns:GetCustomer"/> <output message="tns:GetCustomerResponse"/> </operation> </portType>

  36. WSDL Binding <binding name="CustomerBinding" type="tns:CustomerPortType"> <soap:binding style="rpc" transport= "http://schemas.xmlsoap.org/soap/http"/> <operation> … </operation> … </binding>

  37. WSDL Binding <operation name="GetCustomer"> <soap:operationsoapAction= "http://www.progress.com/Sports"/> <input> <soap:body use="encoded“ encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.e1.com/customer"/> </input> <output> <soap:body use="encoded" encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.e1.com/customer"/> </output> </operation>

  38. WSDL Service <service name="CustomerService"> <port name="CustomerPort" binding="CustomerBinding"> <soap:address location="http://www.example.com/customer"/> </port> </service>

  39. WSDL Support for Attachments Binding <binding name="Customer_Binding" ... /> <soap:binding .../> <operation name="SetCustomerPicture"> <soap:operation ... /> <input> <mime:multipartRelated> <mime:part> <soap:body parts="CustomerId" use="encoded" ... /> </mime:part> <mime:part> <mime:content part="CustomerPicture" type="image/tiff"/> </mime:part> </mime:multipartRelated> </input> <output> … </output> </operation> </binding>

  40. Service Orchestration • A fancy name for a business process • SOAP, WSDL, and "discovery mechanism" allow for loosely integrated Web Services • Business requirement to be able to model and formally describe complex Web Service interactions • Specifies the execution order of a collection of Web Services, e.g. • A travel reservation system • An mortgage application system

  41. WebService WebService Business Process WebService WebService Service Orchestration WebServiceClient • Looks like a Web Service to the outside world • Accessed using WSDL • Needs to be flexible and adaptable • Swap out one service implementation for another • Requirement for a "process engine" that handles the flow between Web Services Web Service

  42. Order Title Search • MortgageApp.wsdl • MortgageApp Porttype • SendMortgageRequest Operation Service Orchestration Mortgage Web Service Receive Mortgage Application Process Mortgage Order Appraisal Order Credit Check Process Application Notify Customer Web Service Invocation Message passing

  43. Service Orchestration • Using standards allow process to be published, shared, and integrated with other processes • Lots of proposed standards – very immature • WSFL • http://www.ibm.com/software/solutions/webservices/pdf/WSFL.pdf • XLANG • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/bts_2002/htm/bts_gs_content_rtzn.asp • BPML • http://www.bpmi.org • WSCI • http://www.w3.org/TR/wsci • BPEL4WS • http://www.ibm.com/developerworks/library/ws-bpel

  44. BPEL4WS • Supercedes XLANG (Microsoft) and WSFL (IBM) • Subset of BPML • XML-based programming language for creating an executable business process • Message oriented • XML-oriented • Basic activities • Receive, reply, invoke • Assign and copy • Messages • Properties (variables) • Faults – throw/catch model

  45. BPEL4WS • Structured activities • Sequences • Execute sequentially • Flows with links • Executes a set of activities in parallel with dependencies controlled by links • Wait • For time-out period • Until a specific date

  46. BPEL4WS • Structured Activities • While • Execute an activity while a condition is true • Switch • Condition behavior based on an expression • Pick • Waits for an event and executes the corresponding activity • Two types of event • A particular message • A timeout

  47. BPEL4WS • Scopes • A way of grouping a set of activities • Can be nested • Can bind a compensation handler to a scope for long running transaction support • Containers • Mechanism for holding messages and passing them from one step to the next

  48. Other Web Services and clients by PortType partners containers faultHandlers <partner>….</partner>* <container>….</container>* <catch>….</catch>* Named storage for message Pointer to application data that correlates a async request with a reply, e.g. accountid correlationSets <correlationSet>….</correlationSet>* Alternate execution path when errors occur Code to execute when "undoing" a transaction compensationHandlers <compensationHandler>…. </compensationHandler>* What the process does. Typically, <sequence> or <flow> (Activity) BPEL4WS Document Structure Process

  49. BPEL4WS <process name="purchaseOrderProcess" …> <partners> <partner name="Customer" serviceLinkType="lns:MortgageAppLT" myRole="MortgageService"/> <partner name="CreditCheckProvider" serviceLinkType="lns:CreditCheckLT" myRole="CreditCheckRequester" partnerRole="CreditCheckService"/> </partners> <containers> <container name="MortgageApp" messageType="lns:POMessage"/> </containers>

  50. BPEL4WS <sequence> <receive partner="customer" portType="lns:MortgageAppPT" operation="sendMortgageApp" container="MortgageApp"> </receive> <invoke partner="CreditCheckProvider" portType="lns:computePricePT" operation="initiateCreditCheck" inputContainer="MortgageApp"> </sequence> </process>