Web Services: JAX-RPC, WSDL, XML Schema, and SOAP

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

Service Description: WSDL COMP6017 Topics on Web Services Dr Nicholas Gibbins –
Web Service Ahmed Gamal Ahmed Nile University Bioinformatics Group
SOAP.
Web Services Web Services are the basic fundamental building blocks of invoking features that can be accessed by an application program. The accessibility.
XML in the real world (2) SOAP. What is SOAP? ► SOAP stands for Simple Object Access Protocol ► SOAP is a communication protocol ► SOAP is for communication.
1 Web Data Management XML Schema. 2 In this lecture XML Schemas Elements v. Types Regular expressions Expressive power Resources W3C Draft:
SE 370: Programming Web Services Week 4: SOAP & NetBeans Copyright © Steven W. Johnson February 1, 2013.
Web Services Darshan R. Kapadia Gregor von Laszewski 1http://grid.rit.edu.
1 An Introduction to Web Services. 2 Outline What is a Web service Background Standards –XML & XML Namespaces, XML Schema,WSDL, SOAP Tools & APIs –DOM/SAX,JAX-RPC/JAX-M.
Presentation 7 part 2: SOAP & WSDL. Ingeniørhøjskolen i Århus Slide 2 Outline Building blocks in Web Services SOA SOAP WSDL (UDDI)
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 42 Web Services.
XML Technologies and Applications Rajshekhar Sunderraman Department of Computer Science Georgia State University Atlanta, GA 30302
Lecture 10: Web Services. Outline Overview of Web Services Create a Web Service with Sun J2EE (JAX-RPC)
Grid Computing, B. Wilkinson, 20043a.1 WEB SERVICES Introduction.
And so on CGI programming Web Services Java Programs for the Web.
WSDL Web Services Description Language Neet Wadhwani University of Colorado 3 rd October, 2001.
1 Java Server Programming zLecture 1 focuses on: yIntroduction to web services y Web Services using Axis y The bigger Picture: Introduction to J2EE y Java.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
1 Lecture 22 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
SSC2: Web Services. Web Services Web Services offer interoperability using the web Web Services provide information on the operations they can perform.
Why XML ? Problems with HTML HTML design - HTML is intended for presentation of information as Web pages. - HTML contains a fixed set of markup tags. This.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
WSDL Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Grid Computing, B. Wilkinson, 20043b.1 Web Services Part II.
WSDL: Web Services Definition Language CS 795/895.
Dr. Azeddine Chikh IS446: Internet Software Development.
Representing Web Data: XML CSI 3140 WWW Structures, Techniques and Standards.
Web Services and Data Integration Zachary G. Ives University of Pennsylvania CIS 455 / 555 – Internet and Web Systems September 20, 2015 Some slides by.
Representing Web Data: XML CSI 3140 WWW Structures, Techniques and Standards.
James Holladay, Mario Sweeney, Vu Tran. Web Services Presentation Web Services Theory James Holladay Tools – Visual Studio Vu Tran Tools – Net Beans Mario.
Web Services Description Language (WSDL) Jason Glenn CDA 5937 Process Coordination in Service and Computational Grids September 30, 2002.
Web Services Week 7 Aims: A detailed look at the underlying mechanisms for communication between web services Objectives: SOAP, WSDL, UDDI.
Web Services Description Language CS409 Application Services Even Semester 2007.
Introduction to Distributed Systems Slides for CSCI 3171 Lectures E. W. Grundke.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
Chapter 6 Server-side Programming: Java Servlets
1 EIE424 Distributed Systems and Networking Programming –Part II 3.1 SOAP – Introduction.
1 Web Service Description Language (WSDL) 大葉大學資工系.
1 WSDL Tutorial Heather Kreger (borrowed from Peter Brittenham) Web Services Architect IBM Emerging Technologies.
Course Schedule Report Web Service Carolyn Cracraft Lisa de Larios-Heiman.
Distributed Programming CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
XML and Web Services (II/2546)
Preliminary Ocean Project Page 1 WGISS SG May 15, C. Caspar G. Tandurella P. Goncalves G. Fallourd I. Petiteville Preliminary Ocean Project Phase.
Introduction to XML Schema John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel: (x2073)
WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic.
Web services. Introduction to WSDL. February 23, 2006.
Intro to Web Services Dr. John P. Abraham UTPA. What are Web Services? Applications execute across multiple computers on a network.  The machine on which.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
1 WSDL Web Services Description Language. 2 Goals of WSDL Describes the formats and protocols of a Web Service in a standard way –The operations the service.
.NET Mobile Application Development XML Web Services.
1 G52IWS: Web Services Description Language (WSDL) Chris Greenhalgh
WP3 Implementing R-GMA grid services in GT3 Abdeslem Djaoui & WP3 Grid Services Task Force 7 th EU Datagrid meeting 26/09/2003
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
DEVELOPING WEB SERVICES WITH JAVA DESIGN WEB SERVICE ENDPOINT.
SOAP, Web Service, WSDL Week 14 Web site:
Beginning 자바 웹 서비스 웹 서비스 호출 Meilan JIANG Cyber infrastructure Research Laboratory Department of Advanced Technology.
The Java API for XML-Based Web Services. A Web Service example in Java SOAP-awareServlet (e.g. Apache Axis2) SOAP-awareServlet Any class processing the.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 9 Web Services: JAX-RPC,
Unit 4 Representing Web Data: XML
Web Programming Developing Web Applications including Servlets, and Web Services using NetBeans 6.5 with GlassFish.V3.
Chapter 5 Remote Procedure Call
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
Writing simple Java Web Services using Eclipse
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
Chapter 7 Representing Web Data: XML
Chapter 9 Web Services: JAX-RPC, WSDL, XML Schema, and SOAP
THE DATATYPES OF XML SCHEMA A Practical Introduction
Introduction to Web Services
Presentation transcript:

Web Services: JAX-RPC, WSDL, XML Schema, and SOAP CSI 3140 WWW Structures, Techniques and Standards Web Services: JAX-RPC, WSDL, XML Schema, and SOAP

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 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

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 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

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 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

Web Services Concepts Web services conceptually are just specialized web applications: HTTP request (SOAP body) Server (Java servlet) Client HTTP response (SOAP body) Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

Web Services Concepts Body of web services request is analogous to calling a method Operation name (like method name) Input parameter names Input parameter values Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

Web Services Concepts Body of web services response is analogous to value returned by a method Return value data type Return value Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

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 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

Web Services Concepts Portions of NWS WSDL Input params Data types defined using XML Schema Return type Operation name Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

Web Services Concepts Java Web Services Developer Pack (JWSDP) wscompile tool can implement a Java API from a WSDL Classes and methods generated by wscompile This method automatically handles SOAP request and response Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

Web Services Concepts Writing the server for a web service with JWSDP: Write a Java interface defining the API Implement the interface JWSDP generates SOAP and communication handling classes WSDL Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

Web Services Concepts Example Java interface Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

Web Services Concepts Example implementation Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

Web Services Examples Tons of WS available on the internet. http://www.webservicex.net as a good collection Geo IP: http://www.webservicex.net/geoipservice.asmx?op=GetGeoIP Whois: http://www.webservicex.net/whois.asmx?op=GetWhoIS SMS: http://www.webservicex.net/sendsmsworld.asmx Etc.. Google: Amazon S3 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Application: currency converter Three operations: fromDollars fromEuros fromYen Input: value in specified currency Output: object containing input value and equivalent values in other two currencies Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Write service endpoint interface May need to write additional classes representing data structures Write class implementing the interface Compile classes Create configuration files and run JWSDP tools to create web service Deploy web service to Tomcat Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Service endpoint interface Must extend java.rmi.Remote Every method must throw java.rmi.RemoteException Parameter/return value data types are restricted No public static final declarations (global constants) Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Allowable parameter/return value data types Java primitives (int, boolean, etc.) Primitive wrapper classes (Integer, etc.) String, Date, Calendar, BigDecimal, BigInteger java.xml.namespace.QName, java.net.URI Struct: class consisting entirely of public instance variables Array of any of the above Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Struct for currency converter app (data type for return values) Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Service endpoint interface Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Write service endpoint interface May need to write additional classes representing data structures Write class implementing the interface Compile classes Create configuration files and run JWSDP tools to create web service Deploy web service to Tomcat Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Class CurConImpl contains methods, for example: Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Write service endpoint interface May need to write additional classes representing data structures Write class implementing the interface Compile classes Create configuration files and run JWSDP tools to create web service Deploy web service to Tomcat Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Configuration file input to wscompile to create server Namespaces used in WSDL (normally, unique URL’s at your Web site) Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Configuration file for web service Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Configuration file for web service Context path Like servlet in web.xml Like servlet-mapping in web.xml Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Also need a minimal web.xml Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Run jar and wsdeploy to create a Web Archive (WAR) file converter.war Name must match urlPatternBase value Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Write service endpoint interface May need to write additional classes representing data structures Write class implementing the interface Compile classes Create configuration files and run JWSDP tools to create web service Deploy web service to Tomcat Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Just copy converter.war to Tomcat webapps directory May need to use Manager app to deploy Enter converter.war in “WAR or Directory URL” text box Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Server Testing success: Visit http://localhost:8080/converter/currency Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Client Goal: write a JSP-based client Input: currency and value Output: table of equivalent values Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Client Configuration file input to wscompile to create client Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Client Directory structure (wscompile generates content of classes and src) Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Client Starting point for writing a client (if the web service author does not explain how): In the WSDL, find the name attribute of the service element Look in Java file with this name to see how to obtain a proxy object for the service Data type of proxy object Method called to obtain object Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Client Obtaining the proxy object: Java file consisting of service name followed by _Impl defines a class implementing the proxy-generating interface Client code begins with method call on this class: Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Client Using the proxy object: Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Client Structs will be represented as JavaBeans classes, regardless of how they are defined on the server Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Client Bean obtaining and calling proxy object: Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

JWSDP: Client JSP document using the bean: Call to getExValues() Call to getEuros() Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

WSDL Example Target namespace: namespace for names (e.g., of operations) defined by the WSDL Namespaces specified in config files WSDL namespaces XML Schema NS Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

WSDL Example Namespace for data type definitions (ns2 in rest of document) Defines struct using XML Schema Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

WSDL Example Data type defined by XML Schema Output messages Input (response data types) Input messages (parameter lists) Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

WSDL Example Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

WSDL Example Implement the operations using SOAP encoding of data structures and RPC (JWSDP defaults) Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

WSDL Example Replaced by server when WSDL is visited Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

WSDL Example Summary: types uses XML Schema to define data types message elements define parameter lists and return types using types and XML Schema portType defines abstract API for operation’s using message’s binding specifies how message’s will be communicated and operation’s called service associates URL with binding Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

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? Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

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 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

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 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

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 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema XML Schema namespace defining built-in types is called the document namespace Standard prefix for this namespace is xsd Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema Plus Java primitive types (int, etc.) Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

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 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

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 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

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 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

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 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema Root element of the markup of an XML schema is schema Define data types with elements: complexType simpleType An XML schema can also define other vocabulary aspects (allowed elements, element content) that we won’t cover Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema One way to define simple types: restrict an existing simple base type Base type Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema Built-in types all have facets, that is, aspects that can be restricted enumeration is a facet that applies to all built-in types except boolean length, minLength, maxLength apply to string-like types (e.g., string, QName, anyURI) minInclusive, maxInclusive, minExclusive, maxExclusive apply to numeric and time-oriented types totalDigits, fractionDigits apply to numeric types Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema Restricting multiple facets: Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema pattern facet applies to most types (except a few DTD) specifies regular expression Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema Other simple types Union: combine two or more types Lists of values of simple type Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema Complex type Defined in an XML schema Used in an instance document Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema Complex type can be used in placed of XML DTD content specification sequence element is equivalent to , operator in DTD Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

XML Schema Instance namespace Used within instance documents to Normally associated with prefix xsi Used within instance documents to define null-valued elements define data types Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

SOAP Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

SOAP Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

SOAP Alternate form Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

SOAP SOAP encoding of arrays in WSDL Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

SOAP Array in SOAP document Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

SOAP If SOAP is sent via HTTP, request must include SOAPAction header field Either empty or a URI Can be used to pass operation rather than embedding in body of message Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

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 Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides

Web Services Technologies Universal Discovery, Description, and Integration (UDDI) Technology for creating directories of web services Web Services-Interoperability Organization (WS-I) Basic Profile Specification of how web services should be used to enhance interoperability Must use XML Schema and literal encoding (rather than SOAP encoding) Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson’s slides