1 / 40

CP3024 Lecture 10

CP3024 Lecture 10. Web Services. What are Web Services?. “encapsulated, loosely coupled, contracted software objects offered via standard protocols” ZapThink Research. Web Services. Encapsulated Web Service implementation is invisible to entities outside the service

harlow
Download Presentation

CP3024 Lecture 10

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CP3024 Lecture 10 Web Services

  2. What are Web Services? • “encapsulated, loosely coupled, contracted software objects offered via standard protocols” ZapThink Research

  3. Web Services • Encapsulated • Web Service implementation is invisible to entities outside the service • Exposes an interface but hides details • Loosely Coupled • Service and consumer software can be redesigned independently

  4. Web Services • Contracted • Description of service is available to consumer • Standard Protocols • TCP/IP • HTTP • XML • SOAP • WSDL • UDDI

  5. Self-describing • Every web service has a published public interface • Minimum of human readable documentation • SOAP services should have interfaces written in XML

  6. Discoverable • Simple mechanism for publishing details about a web service • Simple mechanism for finding a service and its interface • Mechanism could be completely decentralised or centralised registry

  7. A Web Service .. • Is available over network • Uses standardised XML messaging • Is independent of any given OS or language • Is self describing via XML • Is easily discoverable

  8. Web Usage Shift • Human-centric Web • Majority of web transactions initiated by a human • Application-centric Web • Inter-application interchanges • E.g. credit card approval

  9. A Web Service In Action XML XML

  10. Possible Protocols • HTTP POST/GET • XML-RPC • SOAP • Simple Object Access Protocol

  11. Example Service • Return a set of keys given a set of functional dependencies • Service called keyservice • Method called getCandidateKeys • String argument fdSet • Argument sent “{{a}->{b}}”

  12. XML-RPC Service Invocation <?xml version="1.0" encoding="ISO-8859-1"?> <methodCall> <methodName> keyservice.getCandidateKeys </methodName> <params> <param> <value>{{a}-&gt;{b}}</value> </param> </params> </methodCall>

  13. XML-RPC Response <?xml version="1.0" encoding="ISO-8859-1"?> <methodResponse> <params> <param> <value> {{a}} </value> </param> </params> </methodResponse>

  14. SOAP • SOAP envelope specification • Rules for encapsulating the data being transferred • Data encoding rules • Rules for encoding data types • RPC conventions • Rules for invoking remote methods

  15. Example Service Request <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV= http://schemas.xmlsoap.org/soap/envelope/ xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <ns1:getCandidateKeys xmlns:ns1="urn:examples:keyservice" SOAP-ENV:encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/"> <fdSet xsi:type="xsd:string">{{a}-&gt;{b}}</fdSet> </ns1:getCandidateKeys> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  16. Example Service Reply <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <ns1:getCandidateKeysResponse xmlns:ns1="urn:examples:keyservice" SOAP-ENV:encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/"> <return xsi:type="xsd:string">{{a}}</return> </ns1:getCandidateKeysResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  17. Soap Message Envelope (required) Header (optional) Body (required) Fault (optional) Structure of SOAP Messages

  18. Fault Response <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Server</faultcode> <faultstring>Exception from service object: FD: Unexpected end of input</faultstring> <faultactor>/soap/servlet/rpcrouter</faultactor> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  19. Web Services Definition Language (WSDL) • Uses XML to describe a web service • Describes the interface of available functions • Specifies data type information for all requests and responses • Holds binding information about the transport protocol • Contains address information to locate the service

  20. Major Elements • definitions • types • message • portType • binding • ports • service

  21. WSDL definitions <definitions name="KeyService" targetNamespace= "http://localhost:8080/wsdl/Lucchesi.wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap= "http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns= "http://localhost:8080/wsdl/Lucchesi.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  22. WSDL types • Optional element • Defines complex types e.g. arrays and structures • Not used in the example

  23. WSDL message <message name="CandidateKeyRequest"> <part name="FDSet" type="xsd:string"/> </message> <message name="getKeys"> <part name="return" type="xsd:string"/> </message>

  24. WSDL portType <portType name="Key_PortType"> <operation name="getCandidateKeys"> <input message="tns:CandidateKeyRequest" name="Request"/> <output message="tns:getKeys“ name="Response"/> </operation> </portType>

  25. WSDL binding <binding name="Key_Binding" type="tns:Key_PortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="getCandidateKeys"> <soap:operation soapAction="Generate keys"/> <input name="Request"> <soap:body encodingStyle= http://schemas.xmlsoap.org/soap/encoding/ namespace="urn:examples:keyservice" use="encoded"/> </input>

  26. WSDL Binding <output> <soap:body encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:keyservice" use="encoded"/> </output> </operation> </binding>

  27. WSDL Service <service name="Key_Service"> <documentation> WSDL File for KeyService </documentation> <port binding="tns:Key_Binding" name="Key_Port"> <soap:address location= “http://localhost:8080/soap/servlet/rpcrouter” /> </port> </service>

  28. WSDL In Action • Can use WSDL description to generate client code • Can use WSDL description to automatically invoke a service • Can generate WSDL from server code

  29. Available WSDL Services

  30. Generic Soap Client

  31. UDDI • Universal Description, Discovery and Integration • Specification for distributed directory of businesses • Data stored in an XML format • UDDI business registry • Launched May 2001 by IBM and Microsoft

  32. UDDI Development • Developed by IBM, Microsoft and Ariba • Ariba/IBM collaboration on B2B • IBM/Microsoft collaboration on SOAP • Microsoft/Ariba collaboration on BizTalk and cXML • Three revisions and then transfer to standards body • Launched September 2000

  33. UDDI Development • Version 2.0 announced July 2001 • Internationalisation • Complex organisations • Better searching mechanisms • Version 3.0 announced July 2002 • Increased security • Improved WSDL support • Multi-registry topologies • Proactive notifications

  34. UDDI Technical Architecture • UDDI data model • XML schema describing businesses and web services • UDDI API • SOAP based API for publishing and searching UDDI data • UDDI cloud services • Sites implementing UDDI which synchronise regularly

  35. UDDI Data Model • businessEntity • Information about a business • businessService • Information about a web service • bindingTemplate • Information about accessing a service • tModel • Pointer to external technical specification

  36. businessEntity businessService bindingTemplate tModel Relationships

  37. find_binding find_business find_service find_tModel get_bindingDetail get_businessDetail get_serviceDetail get_tModelDetail UDDI Inquiry API

  38. get_authToken discard_authToken save_binding save_business save_service save_tModel delete_binding delete_business delete_service delete_tModel UDDI Publishing API

  39. Use Of UDDI • Publishing • Advertise services • Allow discovery of standards in use • Searching • Locate details about electronic services of business partners • Search for suppliers

  40. Summary • Web Services • Mechanism for electronic business on the Web • Based on XML • SOAP • WSDL • UDDI

More Related