Web services

47
WEB SERVICES

description

 

Transcript of Web services

  • 1. WEB SERVICES

2. LEARNING OUTCOMES At the end of this class, YOU should be able to : Describe the role of web services List component of web services List the specifications used to make web services platform independent 3. DISTRIBUTED COMPUTING ISSUE Software application written in various languages Running on multiple platform Data exchange problem Issue : To exchange data over the internet using similar manner tointer process communication in a single computer. 4. WHAT IS A WEB SERVICE? Can be defined as : software functionality that can be invokedthrough the internet using common protocols A remote component resides in remote web server Something like a remote function that can be called by a program through aweb server Accept parameters and produce results (service output) Service output often not HTML rather XML, text or other contents type Allow application developed using different languages to exchangeinformation 5. CONSTRAINED BY TECHNOLOGY 6. LEVERAGE HTTP 7. ROLE OF WEB SERVICE Expose a remote service or executable procedure to a clientapplication Service requestor Web services are designed to be platform independent No CPU, OS or programming language specific is required for web services Leverage existing technology Extensive use of HTTP and XML Interoperable across disparate programming language It is possible a client written in one programming language communicatingwith server written in different language 8. WHERE WEB SERVICES ARE USED? Within an enterprise (Enterprise Application Integration) Accelerate and reduce cost of integration Cost saving on infrastructure deployment and management Reduce skill requirements Improve reuse Between enterprises (E-business integration, B2B) Providing service to companys customers Accessing services from company partners and suppliers Reduce standard barriers 9. WEB SERVICE CONTEXT World Wide WebComponentsWeb Service Distributed ObjectsStandards 10. WEB SERVICE CONCEPTUAL ARCHITECTURE Service Registry FindService RequestorService DescriptionPublishBindService ProviderServic e Service Description 11. WEB SERVICES CORE XML SPECIFICATION Web Services Definition Language (WSDL) Simple Object Access Protocol (SOAP) Universal Description, Discovery and Integration (UDDI) 12. WEB SERVICE COMPONENT - ARCHITECTURE MAPPING Service Service Registry FindDescriptionIn UDDIPublish Using SOAPService RequestorBindIn Your LanguageService ProviderServic e Service DescriptionIn WSDL 13. RELATIONSHIP BETWEEN STANDARDS Searching for a service (UDDI)http://www.uudi.orgUDDILink to WSDL documentWeb ServiceContract Agreement (WSDL)http://yourservice.com/?WSDLClientWeb ServiceWSDL Web Service ContractCommunication (SOAP)http://yourservice.com/svcAXML/SOAP Body 14. INTERACTION BETWEEN WEB SERVER AND CLIENT UDDI Directory Registered Web ServiceWeb Service Providerwhite1. Declare service to UDDIyellowWeb ServerWSDL WSDL Description DescriptionWeb Servic e2. Client look for a service in UDDI register 3. Download WSDL service to generate proxy or stub for the web serviceWeb Servic eWSDL Description Busines s ObjectGenerated StubWeb Service Client3. Client invoke web service through proxy sending/receiving SOAP messageApplication Server Busines s Object Busines s Object Busines s ObjectEAI & ConnectoryellowBack Office and Enterpris e System 15. WEB SERVICE DEFINITION LANGUAGE (WSDL) Web service need to be defined in order to be discovered by andinterfaced with other services and application WSDL : defined a web service and how to access them Define the location of the service The operations the service exposes Communicates using open protocols Can be discovered using UDDI 16. WSDL DOCUMENT STRUCTURE Abstract Part : describes The message it sends andreceives The operation associates amessage exchange pattern with one or more message Concrete Part: specifiesWSDL Specification Abstract Part types messages operationsport types Transport and wire formatdetails for one or more interfaces A port (end point) associates anetwork address with a binding A service which groupstogether end points that implement a common interfaceConcrete Part bindings services and ports 17. WSDL DOCUMENT STRUCTURE Define data types used by the web serviceA group of related input/output The operation performed by the web services The element defines the message format and protocol details for each port Define operation expose by each port 18. A group of related input and output messages define parts and its associated type 19. Elements that defines operations which are made up of messages The operation performed by the web services Comparable to a library in traditional programming 20. COMPARABLE TO TRADITIONAL PROGRAMMING procurementPortType is comparable to function library orderGoods is comparable to a function with OrderMsg asinput parameter and OrderResponseMsg as return type 21. OPERATION TYPE TypeDefinitionOne-wayThe operation can receive a message but will not return a response The operation can receive a request and will return a response The operation can send a request and will wait for a response The operation can send a message but will not wait for a responseRequest-response Solicit-response Notification 22. REQUEST-RESPONSE 23. ONE WAY OPERATION 24. This element defines the message format and protocol details foreach port Attributes in type : name of port type name : bindings name Sub Element of soap:binding style: rpc / document transport (Communication protocol: SOAP, Transport protocol : HTTP/SMTP) operation: Define operation that the port exposes Must specify how input and output encoded 25. 26. A service may have more than one end point, with each onedefined by its own port The port elements corresponds to a particular binding andincludes information on how to access it. 27. messagesoperation and port typeconcrete part bindingport and serviceCopyright Springer Verlag Berlin Heidelberg 2004abstract part 28. UNIVERSAL DESCRIPTION, DISCOVERY AND INTEGRATION (UDDI) UDDI platform independent framework to describe services, discover businesses, integrate business services by using the Internet Directory for storing information about web services Directory of web service interfaces described by WSDL Communicates via SOAP 29. SIMPLE OBJECT ACCESS PROTOCOL (SOAP) SOAP is a protocol for accessing a Web Service Communication protocol For communication between applications Format for sending messages 30. WHY SOAP? RPC is used to communicate between objects like CORBA andDCOM HTTP is not designed for this RPC represents a compatibility but with drawbacks. Security problem -firewalls and proxy servers will normally block this kind oftraffic SOAP is a better way to communicate between application usingHTTP HTTP is supported by all web browsers 31. SOAP DOCUMENT STRUCTURE EnvelopeSOAP ENVELOPE element that identifies the XMLdocument as a SOAP message Header element that contains headerinformation Body element that contains call andresponse information Fault element containing errors andstatus informationHeader Body Fault 32. SOAP DOCUMENT STRUCTURE Contains application-specific information about the SOAP message Contains the actual SOAP message Used to indicate error messages 33. Root element of a SOAP message Defines the XML document as a SOAP messagedefines the Envelope as a SOAP Envelope Used to define the data types used in the document May appear on any SOAP element, and applies to the element's contents and all child elements A SOAP message has no default encoding 34. Contains application-specific information (like authentication,payment, etc) about the SOAP message Attributes of mustUnderstand actor encodingStyledefines how a recipient should process the SOAP message 35. mustUnderstand Indicate whether a header entry is mandatory or optional for therecipient to process Syntax = soap:mustUnderstand="0|1" 1 : the SOAP server and the node that receives the messagecontaining the header block must be able to process it correctly or issue an appropriate fault messsage 234 36. actor Used to address the Header element to a specific endpoint234 37. Contains the actual SOAP message requests the price of applesapplicationspecific elementsApples 38. Contains the actual SOAP messageapplicationspecific elementsApples 39. A RESPONSE COULD LOOK LIKE 1.90 40. To indicate error messages Must appear as a child element of the Body element. A Fault element can only appear once in a SOAP message 41. SUB ELEMENTS Sub ElementDescriptionA code for identifying the faultA human readable explanation of the faultInformation about who caused the fault to happenHolds application specific error information related to the Body element 42. SOAP-ENV:ClientMessage does not have necessary infohttp://gizmos.com/order Quantity element does not have a value Incomplete address: no zip code 43. CODES ErrorDescriptionVersionMismatchFound an invalid namespace for the SOAP Envelope elementMustUnderstandAn immediate child element of the Header element, with the mustUnderstand attribute set to "1", was not understood The message was incorrectly formed or contained incorrect information There was a problem with the server so the message could not proceedClient Server 44. BINDING SOAP WITH A TRANSFER PROTOCOL SOAP binding describes how a SOAP message is carried in a transportprotocol (eg., HTTP, SMTP or FTP). For example, to bind SOAP to HTTP: A SOAP request is wrapped inside an HTTP POST The HTTP POST request species at least two HTTP headers: Content-Type andContent-Length. Content-Type: defines the MIME type for the SOAP message and the character encoding(optional) used Content-Length: specifies the number of bytes in the body of the SOAP request orresponse. Example POST /stockquote HTTP/1.1 Content-Type: text/xml; charset=utf-8 Content-Length: 482 45. BINDING SOAP WITH A TRANSFER PROTOCOL Service ProviderHTTP Post RequestSOA P Engin eHTTP Engin eHTTP ResponseSOAP EnvelopeSOAP EnvelopeSOAP HeaderSOAP HeaderSOAP BodySOAP BodyMethod Request NameMethod Returnparam1Return paramparam2Service Requestor SOA P Engin eHTTP Engin e 46. Host: www.stockquoteserver.com Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "Some-URI 234 Apples BINDING SOAP TO HTTP REQUESTPOST /StockQuote HTTP/1.1 47. Content-Type: text/xml; charset="utf-8" Content-Length: nnnn 1.90 BINDING SOAP TO HTTP RESPONSEHTTP/1.1 200 OK