html5-img
1 / 62

Web Service

Web Service. YU-RONG CHEN June 5 th 2014. Outline. Web Service SOAP WSDL UDDI Implementation RESTful Web Service REST Example Implementation Comparison. What is a Web Service?. “a method of communication between two electronic devices over the Web ” From Wiki

Télécharger la présentation

Web Service

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. Web Service YU-RONG CHEN June 5th 2014

  2. Outline • Web Service • SOAP • WSDL • UDDI • Implementation • RESTful Web Service • REST • Example • Implementation • Comparison

  3. What is a Web Service? • “a method of communication between two electronic devices over the Web” • From Wiki • “a software system designed to support interoperable machine-to-machine interaction over a network” • From W3C (World Wide Web Consortium)

  4. Why we use web services? • Interoperability • Web Services take Web-applications to the next level • Web Services have two types of uses • Reusable application-components • Connect existing software

  5. Web Service Architecture Universal Description, Discovery and Integration Web Services Description Language Simple Object Access Protocol

  6. SOAP • Simple Object Access Protocol • An XML based protocol for accessing Web Services. • Exchanges messages between different machines. • codifies the use of XML as an encoding scheme for request and response parameters using HTTP as a means for transport.

  7. `

  8. WSDL • Web Services Description Language • WSDL is an XML-based language for describing • what a service does • where it resides • how to invoke it • Characteristics of WSDL • Operations and messages are described abstractly • Defines bindings to message formats and protocols

  9. WSDL document content • Abstract(interface) definition: • Concrete(implementation) definition

  10. WSDL Example http://www.webservicex.net/globalweather.asmx?WSDL

  11. Abstract data type definitions

  12. Data that is sent Data that is returned

  13. portType with operations Operations with request & response message

  14. Bind an abstract operation to this implementation and map the abstract input and output messages to these concrete messages

  15. Service name Network address of service

  16. UDDI • Universal description, discovery, and integration • UDDI is a registry standard for Web service description and discovery together with a registry facility that supports the WS publishing and discovery processes. • UDDI enables a business to: • describe its business and its services • discover other businesses that offer desired services • integrate (interoperate) with these other businesses

  17. UDDI(cont.) • Conceptually, a UDDI business registration consists of three inter-related components • “white pages” (address, contact, and other key points of contact) • “yellow pages” classification info. based on standard industry taxonomies • “green pages”, the technical capabilities and information about services

  18. UDDI Data Structure • The UDDI XML schema defines 4core types of information • businessEntity: a description of the organization that provides the service. • businessService: a list of all the Web services offered by the business entity. • bindingTemplate: describes the technical aspects of the service being offered. • tModel: (“technical model”) is a generic element that can be used to store technical information on how to use the service, conditions for use, guarantees, etc.

  19. How to implement Soap WS? • Two ways to implement: • Contract-First • encourages developers to think of the service contract first, in terms ofXML, using XML schema (.xsd) and WSDL • Contract-Last • expose an existing service interface as a web service • many tools and libraries can help expose a Java class/interface as a web service • define the contract for this web service as the laststep in the development process by generating it from Java code • Develop Contract-Last web Service • JAVA Service Programs Development • Web ServicesExposition Development • Web Services Client Development

  20. Environment • JDK • jdk1.7.0_17 • Eclipse • Helios 7.1.1 • Tomcat • apache-tomcat-7.0.37

  21. Programs Development (1/4) • Create Project • File  New  Dynamic Web Project

  22. Programs Development (2/4) • Project Name • PurchaseOrder • Target runtime • Apache Tomcat

  23. Programs Development (3/4) • Create a Class • Package ws.com • Class WebService_purchaseOrder

  24. Programs Development (4/4) • Method • purchase_order_billTo Service functionality: Input two parameter: String Op1,int cash Output a String

  25. Web services Development (1/5) • Create Web services • JavaFile  Web Services  Create Web Services

  26. Web services Development (2/5)

  27. Web services Development (3/5) Methods

  28. Web services Development (4/5)

  29. Web services Development (5/5) Generate wsdl

  30. WSDL

  31. WSDL

  32. Test WSDL

  33. Web services Client Development (1/1) • New a Dynamic Web Project • New a Web Service Client

  34. Web services Client Development (1/4) • Choose WSDL

  35. Web services Client Development (2/4) • Use Test Client

  36. Web services Client Development (3/4) • Choose output folder

  37. Web services Client Development (4/4) • Client Testconfiguration setting

  38. Web services ClientTest Page

  39. Criticisms • Too complex, not open source • A custom interface requires a custom client for every service • Concerns about performance due to XML and SOAP/HTTP in enveloping and transporting

  40. RESTfulWeb Service

  41. REST(REpresentational State Transfer) • Introduced by Roy Fielding in his doctoral dissertation • He is one of the principal authors of the HTTP specification version 1.0 and 1.1 • Asoftware architectural style. • Interact with stateful resources, rather than messages or operations • Use HTTP standard operations such as GET, POST, PUT, DELETE

  42. Noun(Resource) Representation(Content Type) Verb(method) Browser REST is kind of behavior to transfer the state of content type

  43. REST Triangle (Resources)

  44. HTTP methods

  45. Architectural Elements • Component • is an abstract unit of software instructions and internal state that provides a transformation of data via its interface • Connector • is an abstract mechanism that mediates communication, coordination, or cooperation among components • Data • is an element of information that is transferred from a component, or received by a component, via a connector

  46. Architectural Constraints • Client-server • Stateless • Server contains no client state • Self-descriptive messages • Cacheable • Clients can cache responses • Layered system • Clients cannot tell whether it’s connected directly to the end server, or an intermediary • Code on demand (optional) • Servers can temporarily extend or customize the functionality of a client by the transfer of executable code. • Uniform interface

More Related