JAXB: Binding between XML Schema and Java Classes



Similar documents
The Java Web Services Tutorial. For Java Web Services Developer s Pack, v2.0

JAXB Tips and Tricks Part 2 Generating Java Classes from XML Schema. By Rob Ratcliff

RPC over XML. Web services with Java. How to install it? Reference implementation. Setting the environment variables. Preparing the system

JAVA API FOR XML WEB SERVICES INTRODUCTION TO JAX-WS, THE JAVA API FOR XML BASED WEB SERVICES (SOAP, WSDL)

Web Services Development using Top-down Design

Java Web Services Training

Concrete uses of XML in software development and data analysis.

CS 378 Big Data Programming. Lecture 9 Complex Writable Types

Structured Data and Visualization. Structured Data. Programming Language Support. Programming Language Support. Programming Language Support

Java RMI, RMI Tunneling and Web Services Comparison and Performance Analysis

Advanced Information Management

Cúram Web Services Guide

Service Oriented Architecture

WEB SERVICES. Revised 9/29/2015

ITS. Java WebService. ITS Data-Solutions Pvt Ltd BENEFITS OF ATTENDANCE:

JVA-561. Developing SOAP Web Services in Java

Developing Java Web Services

Serializing Data with Protocol Buffers. Vinicius Vielmo Cogo Smalltalks, DI, FC/UL. February 12, 2014.

SSC - Web development Model-View-Controller for Java web application development

Easy-Cassandra User Guide

BUSINESS RULES CONCEPTS... 2 BUSINESS RULE ENGINE ARCHITECTURE By using the RETE Algorithm Benefits of RETE Algorithm...

vsphere Web Services SDK Programming Guide vsphere Web Services SDK 5.1

Java 7 Recipes. Freddy Guime. vk» (,\['«** g!p#« Carl Dea. Josh Juneau. John O'Conner

Extending XSLT with Java and C#

Web Services with ASP.NET. Asst. Prof. Dr. Kanda Saikaew Department of Computer Engineering Khon Kaen University

Oracle Java CAPS Message Library for EDIFACT User's Guide

JAVA API FOR XML WEB SERVICES (JAX-WS)

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANKULATHUR DEPARTMENT OF COMPUTER APPLICATIONS SUBJECT : MC7502 SERVICE ORIENTED ARCHITECTURE

Spring,2015. Apache Hive BY NATIA MAMAIASHVILI, LASHA AMASHUKELI & ALEKO CHAKHVASHVILI SUPERVAIZOR: PROF. NODAR MOMTSELIDZE

MDHT Capabilities & Success Story

Java EE 7: Back-End Server Application Development

Semester Thesis Traffic Monitoring in Sensor Networks

RMI Client Application Programming Interface

Oracle SOA Suite Developer s Guide

Toward Remote Object Coherence with Compiled Object Serialization for Distributed Computing with XML Web Services

The end. Carl Nettelblad

XML & Databases. Tutorial. 2. Parsing XML. Universität Konstanz. Database & Information Systems Group Prof. Marc H. Scholl

ASM 4.0 A Java bytecode engineering library. Eric Bruneton

Service Oriented Computing: SOAP, WSDL and UDDI. Dr. Cristian Mateos Diaz ( ISISTAN - CONICET

Introduction to Java. CS 3: Computer Programming in Java

NetBeans IDE Field Guide

Web Services Development for IBM WebSphere Application Server V7.0. Version: Demo. Page <<1/10>>

Introducing Apache Pivot. Greg Brown, Todd Volkert 6/10/2010

D-Bus Language Bindings for oorexx

Lecture 9. Semantic Analysis Scoping and Symbol Table

Chapter 2 Database System Concepts and Architecture

Java (12 Weeks) Introduction to Java Programming Language

SQLMutation: A tool to generate mutants of SQL database queries

CHAPTER 9: DATAPORT AND XMLPORT CHANGES

WA2087 Programming Java SOAP and REST Web Services - WebSphere 8.0 / RAD 8.0. Student Labs. Web Age Solutions Inc.

WebSphere Business Monitor

Visual Basic. murach's TRAINING & REFERENCE

Model Deployment. Dr. Saed Sayad. University of Toronto

Automating the DEVS Modeling and Simulation Interface to Web Services

XML Schema Definition Language (XSDL)

Author: Gennaro Frazzingaro Universidad Rey Juan Carlos campus de Mostòles (Madrid) GIA Grupo de Inteligencia Artificial

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

NetIQ Aegis Adapter for VMware vcenter Server

Tail-f White Paper. Configuration Management Simplified. Executive summary. Why NETCONF and YANG?

Chapter 1 Fundamentals of Java Programming

DEVELOPING CONTRACT - DRIVEN WEB SERVICES USING JDEVELOPER. The purpose of this tutorial is to develop a java web service using a top-down approach.

High Performance XML Data Retrieval

An Interface from YAWL to OpenERP

Unified XML/relational storage March The IBM approach to unified XML/relational databases

Using mobile phones to access Web Services in a secure way. Dan Marinescu

Java Interview Questions and Answers

Module 13 Implementing Java EE Web Services with JAX-WS

JAVA r VOLUME II-ADVANCED FEATURES. e^i v it;

Smooks Dev Tools Reference Guide. Version: GA

Schema XmlCreditosGastos.xsd

Developing XML Solutions with JavaServer Pages Technology

Database Application Developer Tools Using Static Analysis and Dynamic Profiling

CRM On Demand. Oracle Web Services On Demand Guide

IBM SPSS Collaboration and Deployment Services Version 6 Release 0. Single Sign-On Services Developer's Guide

Scoping (Readings 7.1,7.4,7.6) Parameter passing methods (7.5) Building symbol tables (7.6)

DataDirect XQuery Technical Overview

Lesson 4 Web Service Interface Definition (Part I)

JDeveloper 11g JAX-WS web services:

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007

TECHNOLOGY Computer Programming II Grade: 9-12 Standard 2: Technology and Society Interaction

Arrays. Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays:

Please report this problem on the Codebeamer support site with as much detail as possible so we know how to reproduce it:

Chapter 2: Remote Procedure Call (RPC)

How To Understand And Understand Common Lisp

Habanero Extreme Scale Software Research Project

Distributed Network Management Using SNMP, Java, WWW and CORBA

Implementation Aspects of OO-Languages

Interface Definition Language

Introduction to Java

Transcription:

JAXB: Binding between XML Schema and Java Classes Asst. Prof. Dr. Kanda Runapongsa (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University Agenda JAXB Architecture Representing XML Content Binding XML Schemas Customizing JAXB Bindings General Usage Instructions Basic Examples Customizing JAXB Bindings Java-toSchema Examples University 1

What is JAXB? JAXB stands fro Java Architecture for XML Binding JAXB provides a fast and convenient way to bind between XML schemas and Java representations JAXB makes it easy for Java developers to incorporate XML data and processing functions in Java applications JAXB Architectural Overview University 2

JAXB Architectural Components (1/2) Schema compiler Binds a source schema to a set of schema derived program elements The binding is described by an XMLbased binding language Schema generator Maps a set of existing program elements to a derived schema The mapping is described by program annotations JAXB Architectural Components (2/2) Binding runtime framework Provides unmarshalling (reading) and marshalling (writing) operations Accessing, manipulating and validating XML content using Schema-derived or Existing program elements University 3

The JAXB Binding Process Steps in the JAXB Binding Process (1/4) 1. Generate classes An XML schema is used as input to the JAXB binding compiler to generate JAXB classes based on that schema 2. Compile classes All of the generated classes, source files, and application code must be compiled University 4

Steps in the JAXB Binding Process (2/4) 3. Unmarshal XML documents written according to the constraints in the source schema are unmarshalled by the JAXB binding framework JAXB also supports unmarshalling XML data from sources other than files/document, such as DOM nodes, string buffers, SAX Sources, and so forth Steps in the JAXB Binding Process (3/4) 4. Generate content tree The unmarshalling process generates a content tree of data objects instantiated from the generated JAXB classes This content tree represents the structure and content of the source XML documents 5. Validate (optional) The unmarshalling process optionally involves validation of the source XML document before generating the content tree University 5

Steps in the JAXB Binding Process (4/4) 6. Process content The client application can modify the XML data represented by the Java content tree by means of interfaces generated by the binding compiler 7. Marshal The processed content tree is marshalled out to one or more XML output documents The content may be validated before marshalling Java Representation of XML Schema JAXB supports the grouping of generated classes in Java packages. A package comprises: A Java class name is derived from the XML element name, or specified by a binding customization. An ObjectFactory class is a factory that is used to return instances of a bound Java class. University 6

Default Data Type Bindings (1/5) XML Schema Type Java Data Type xsd:string xsd:integer xsd:int xsd:long xsd:short java.lang.string java.math.biginteger int long short Default Data Type Bindings (2/5) XML Schema Type Java Data Type xsd:decimal xsd:float xsd:double xsd:boolean xsd:byte java.math.bigdecimal float double boolean byte University 7

Default Data Type Bindings (3/5) XML Schema Type xsd:qname xsd:datetime xsd:base64binary xsd:hexbinary Xsd:unsignedInt Java Data Type javax.xml.namespace.q Name Javax.xml.datatype. XMLGregorianCalendar byte[] byte[] long Default Data Type Bindings (4/5) XML Schema Type xsd:unsignedshort xsdunsignedbyte xsd:time xsd:date xsd:g Java Data Type int short XMLGregorianCalendar XMLGregorianCalendar XMLGregorianCalendar University 8

Default Data Type Bindings (5/5) XML Schema Type xsd:anysimpletype xsd:duration xsd:notation Java Data Type java.lang.object Duration javax.xml.namespace.qname Mapping of Java Classes to XML Data Types (1/3) Java Class java.lang.string java.math.biginteger java.math.bigdecimal java.util.calendar java.util.date XML Data Type xs:string xs:integer xs:decimal xs:datetime xs:datetime University 9

Mapping of Java Classes to XML Data Types (2/3) Java Class javax.xml.namespace. QName java.net.uri java.util.uuid XMLGregorianCalendar XML Data Type xs:qname xs:string xs:string xs:anysimpletype Mapping of Java Classes to XML Data Types (3/3) Java Class Duration javax.lang.object java.awt.image javax.activiation. DataHandler Javax.xml.transform.Sour ce XML Data Type xs:duration xs:anytype xs:base64binary xs:base64binary xs:base64binary University 10

Customizing JAXB Bindings Schema-to-Java Custom JAXB binding declarations also allow you to customize your generated JAXB classes to include Java-specific refinements such as class and pacage name mappings JAXB provides two ways to customize an XML schema As inline annotations in a source XML schema As declaration in an external binding customizations file that is passed to the JAXB binding compiler Java-to-Schema XML schema that is generated from Java objects can be customized with JAXB annotations References Java Web Services Developer Pack 2.0 http://java.sun.com/webservices/downlo ads/webservicespack.html University 11