Presentation is loading. Please wait.

Presentation is loading. Please wait.

Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 Chapter 9 Web Services: JAX-RPC,

Similar presentations


Presentation on theme: "Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 Chapter 9 Web Services: JAX-RPC,"— Presentation transcript:

1 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 Chapter 9 Web Services: JAX-RPC, WSDL, XML Schema, and SOAP WEB TECHNOLOGIES A COMPUTER SCIENCE PERSPECTIVE JEFFREY C. JACKSON

2 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 Web Services Concepts A web application uses Web technologies to provide functionality to an end user A web service uses Web technologies to provide functionality to another software application

3 Web Services Components XML – eXtensible Markup Language – A uniform data representation and exchange mechanism. SOAP – Simple Object Access Protocol – A standard way for communication. UDDI – Universal Description, Discovery and Integration specification – A mechanism to register and locate WS based application. WSDL – Web Services Description Language – A standard meta language to described the services offered.

4 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 Web Services Concepts Standard web services technologies: –Communication via SOAP XML vocabulary documents over HTTP –Operations of web service defined by Web Services Definition Language (WSDL) XML vocabulary –Data within WSDL defined using XML Schema

5 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 Web Services Concepts Higher-level API’s are often used to automatically generate web services client and server communication software –We will use the Java API for XML-based Remote Procedure Call (JAX-RPC) –Microsoft.NET framework is one popular alternative to JAX-RPC

6 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 Web Services Concepts Web services conceptually are just specialized web applications: Client Server (Java servlet) HTTP request (SOAP body) HTTP response (SOAP body)

7 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 Web Services Concepts WSDL defines web service –Operations –Parameters –Return values –Communication protocols Basically an API for the web service –Facilitates automated client/server software generation

8 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 XML Schema How do we send a Java double value to a web service using XML? –Is scientific notation allowed? –How large can the value be? –Etc. What if we want to send an object? –And what if the object contains references to other objects?

9 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 XML Schema XML Schema addresses such questions –Defines a number of simple data types, including Range of allowed values How values are represented as strings –Provides facilities for defining data structures in terms of simple types or other data structures Can also be used in place of XML DTD (Document Type Definition)

10 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 XML Schema Built-in data types –Types corresponding to Java primitive types: boolean, byte, int, double, etc. String representations much as Java –Exception: can use 0 for false, 1 for true No char ; use string instead –XML DTD types ( ID, CDATA, etc.) Built-in type

11 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 XML Schema Built-in data types –integer and decimal (arbitrary precision) –dates, times, and related subtypes –URLs –XML namespace qualified names –binary data –some restricted forms of the above, e.g., nonNegativeInteger

12 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 XML Schema XML Schema namespace defining built-in types is called the document namespace –Standard prefix for this namespace is xsd

13 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 XML Schema Plus Java primitive types ( int, etc.)

14 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 XML Schema Mapping from XML Schema data types to Java: –Primitives: one-for-one mapping –date, time, dateTime : map to Calendar –most others: map to String

15 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 XML Schema Elements in the document namespace can declare user-defined data types Two XML Schema data types: –Complex: requires markup to represent within an XML document –Simple: can be represented as character data

16 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 XML Schema User-defined data types are declared in the types element of a WSDL –Example: ExchangeValue In WSDL, user-defined types can be used –To define other data types within types element –To specify data types of parameters and return values in message elements

17 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 XML Schema

18 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 XML Schema An XML schema is markup that –Is written according to the XML Schema vocabulary –Defines an XML vocabulary A schema document is an XML document consisting entirely of an XML schema A document conforming with an XML schema vocabulary is call an instance of the schema

19 XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe data. XML tags are not predefined. You must define your own tags. The prefect choice for enabling cross- platform data communication in Web Services.

20 XML vs HTML An HTML example: <html><body> John Doe John Doe 2 Backroads Lane 2 Backroads Lane New York New York 045935435 045935435 john.doe@gmail.com john.doe@gmail.com </body></html>

21 XML vs HTML This will be displayed as: HTML specifies how the document is to be displayed, and not what information is contained in the document. Hard for machine to extract the embedded information. Relatively easy for human. John Doe 2 Backroads Lane New York 045935435John.doe@gmail.com

22 XML vs HTML Now look at the following: In this case: –The information contained is being marked, but not for displaying. –Readable by both human and machines. <contact> John Doe John Doe 2 Backroads Lane 2 Backroads Lane New York New York 045935435 045935435 john.doe@gmail.com john.doe@gmail.com </contact>

23 SOAP SOAP originally stood for "Simple Object Access Protocol". Web Services expose useful functionality to Web users through a standard Web protocol called SOAP. Soap is an XML vocabulary standard to enable programs on separate computers to interact across any network. SOAP is a simple markup language for describing messages between applications. Soap uses mainly HTTP as a transport protocol. That is, HTTP message contains a SOAP message as its payload section.

24 SOAP Characteristics SOAP has three major characteristics: –Extensibility – security and WS-routing are among the extensions under development. –Neutrality - SOAP can be used over any transport protocol such as HTTP, SMTP or even TCP. –Independent - SOAP allows for any programming model.

25 SOAP Building Blocks A SOAP message is an ordinary XML document containing the following elements: –A required Envelope element that identifies the XML document as a SOAP message. –An optional Header element that contains header information. –A required Body element that contains call and response information. –An optional Fault element that provides information about errors that occurred while processing the message.

26 SOAP Request POST /InStock HTTP/1.1 Host: www.stock.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: 150 <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle=http://www.w3.org/2001/12/soap-encoding ” > IBM IBM

27 SOAP Response HTTP/1.1 200 OK Content-Type: application/soap; charset=utf-8 Content-Length: 126 34.5 34.5 </soap:Envelope>

28 WSDL WSDL stands for Web Services Description Language. WSDL is an XML vocabulary for describing Web services. It allows developers to describe Web Services and their capabilities, in a standard manner. WSDL specifies what a request message must contain and what the response message will look like in unambiguous notation. In other words, it is a contract between the XML Web service and the client who wishes to use this service. In addition to describing message contents, WSDL defines where the service is available and what communications protocol is used to talk to the service.

29 The WSDL Document Structure A WSDL document is just a simple XML document. It defines a web service using these major elements: –port type - The operations performed by the web service. –message - The messages used by the web service. –types - The data types used by the web service. –binding - The communication protocols used by the web service.

30 WSDL Document

31 UDDI UDDI stands for Universal Description, Discovery and Integration. UDDI is a directory for storing information about web services, like yellow pages. UDDI is a directory of web service interfaces described by WSDL.

32 Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 Web Services Technologies Other implementation of JAX-RPC and/or Java-based web services –Apache Axis –IBM WebSphere Microsoft support for web services:.NET PHP also has web services tools


Download ppt "Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved. 0-13-185603-0 Chapter 9 Web Services: JAX-RPC,"

Similar presentations


Ads by Google