SlideShare a Scribd company logo
Copyright © 2012, Oracle and/or its affiliates. 1 All rights reserved.
Best Practices for 
Interoperable XML 
Databinding with JAXB 
Martin Grebac, 
SW Engineering Manager, Oracle 
(Project METRO)
The following is intended to outline our general product direction. It is intended 
for information purposes only, and may not be incorporated into any contract. 
It is not a commitment to deliver any material, code, or functionality, and should 
not be relied upon in making purchasing decisions. The development, release, 
and timing of any features or functionality described for Oracle’s products 
remains at the sole discretion of Oracle. 
Copyright © 2012, Oracle and/or its affiliates. 3 All rights reserved.
Program Agenda 
§ Quick intro 
§ Why? The Reasoning 
§ General Limitations & W3C approach 
§ Common-sense approach 
– Complexities to avoid 
– The safe intersection 
– Examples 
Copyright © 2012, Oracle and/or its affiliates. 4 All rights reserved.
Quick Intro 
Copyright © 2012, Oracle and/or its affiliates. 5 All rights reserved.
“XML data binding refers to a means of representing 
information in an XML document as an object in 
computer memory.” 
Wikipedia 
<Item ItemNumber="2"> 
<Part PartNumber="456"> 
<Description> bla bla…</Description> 
<Price>13.27</Price> 
</Part> 
<Quantity>5</Quantity> 
</Item> 
Copyright © 2012, Oracle and/or its affiliates. 6 All rights reserved. 
Item 
ItemNumber: 2 
Quantity: 5 
Part 
PartNumber: 456 
Description: bla bla … 
Price: 13.27
XML DataBinding – Where to Find 
§ Direct 
– Direct use of JAXB or other Databinding APIs 
§ Indirect 
– Web Services, JAX-WS, Jersey, REST, … 
§ Based on grammar (XML Schema, DTD, RelaxNG, …) 
– Classes usually represent the schema structures 
– Instances represent content of XML document 
– Schema feature set is large 
Copyright © 2012, Oracle and/or its affiliates. 7 All rights reserved.
WHY? - The Reasoning 
Copyright © 2012, Oracle and/or its affiliates. 8 All rights reserved.
Number of XML Databinding frameworks 
§ Axis 
§ .NET 
§ IBM RAD 
§ Mono 
§ gSOAP2 
§ Castor 
§ WCF 
§ JAXB 
§ XBinder 
Copyright © 2012, Oracle and/or its affiliates. 9 All rights reserved. 
§ SOAP4R 
§ Spring 
§ Castor 
§ Xbinder 
§ Xfire 
§ ZSI 
§ XMLBeans 
§ PHP 
§ ADB 
§ …
Common XML Databinding Framework 
Limitations 
§ Round-trip limitations 
– Sibling Order 
– Physical Structure 
– Comments and Processing Instructions 
– XML Declaration 
§ Feature limitations 
– Incomplete schema support 
– Transformations 
– Document Fragment support 
Copyright © 2012, Oracle and/or its affiliates. 10 All rights reserved.
Common XML Databinding Framework 
Limitations 
§ Round-trip limitations 
– Sibling Order 
– Physical Structure 
– Comments and Processing Instructions 
– XML Declaration 
§ Feature limitations 
– à Incomplete schema support 
– Transformations 
– Document Fragment support 
Copyright © 2012, Oracle and/or its affiliates. 11 All rights reserved.
Do you start from schema? 
Copyright © 2012, Oracle and/or its affiliates. 12 All rights reserved. 
XML Schema
Do you start from schema? 
Copyright © 2012, Oracle and/or its affiliates. 13 All rights reserved. 
XML Schema 
XML Document
Do you start from schema? 
Copyright © 2012, Oracle and/or its affiliates. 14 All rights reserved. 
XML Document 
Databinding 
/ 
Web Service 
framework 1 
Objects 
XML Schema 
Limited 
support
Or do you start from classes? 
Copyright © 2012, Oracle and/or its affiliates. 15 All rights reserved. 
XML Document 
Databinding 
/ 
Web Service 
framework 2 
Databinding 
/ 
Web Service 
framework 
1 
Objects 
Objects 
XML Schema 
Limited 
support 
Databinding 
/ 
Web Service 
framework 3 
Objects 
Limited 
support
Or do you start from classes? 
Copyright © 2012, Oracle and/or its affiliates. 16 All rights reserved. 
Objects
Or do you start from classes? 
Copyright © 2012, Oracle and/or its affiliates. 17 All rights reserved. 
XML Document 
Databinding 
/ 
Web Service 
framework 
1 
Objects
Or do you start from classes? 
Copyright © 2012, Oracle and/or its affiliates. 18 All rights reserved. 
XML Document 
Databinding 
/ 
Web Service 
framework 
1 
Objects 
XML Schema
Or do you start from classes? 
Copyright © 2012, Oracle and/or its affiliates. 19 All rights reserved. 
XML Document 
Databinding 
/ 
Web Service 
framework 
1 
Objects 
XML Schema
Or do you start from classes? 
Copyright © 2012, Oracle and/or its affiliates. 20 All rights reserved. 
XML Document 
Databinding 
/ 
Web Service 
framework 2 
Databinding 
/ 
Web Service 
framework 
1 
Objects 
Objects 
XML Schema 
Limited 
support
Or do you start from classes? 
Copyright © 2012, Oracle and/or its affiliates. 21 All rights reserved. 
XML Document 
Databinding 
/ 
Web Service 
framework 2 
Databinding 
/ 
Web Service 
framework 
1 
Objects 
Objects 
XML Schema 
Limited 
support 
Databinding 
/ 
Web Service 
framework 3 
Objects 
Limited 
support
Number of XML Databinding frameworks 
§ Axis 
§ .NET 
§ IBM RAD 
§ Mono 
§ gSOAP2 
§ Castor 
§ WCF 
§ JAXB 
§ XBinder 
Copyright © 2012, Oracle and/or its affiliates. 22 All rights reserved. 
§ SOAP4R 
§ Spring 
§ Castor 
§ Xbinder 
§ Xfire 
§ ZSI 
§ XMLBeans 
§ PHP 
§ ADB 
§ …
LOOKS PRETTY BAD … 
Copyright © 2012, Oracle and/or its affiliates. 23 All rights reserved.
LOOKS PRETTY BAD … 
… I’M DEPRESSED. 
Copyright © 2012, Oracle and/or its affiliates. 24 All rights reserved.
LOOKS PRETTY BAD … 
… I’M DEPRESSED. 
NOW WHAT? 
Copyright © 2012, Oracle and/or its affiliates. 25 All rights reserved.
Now what? 
The W3C Approach 
Copyright © 2012, Oracle and/or its affiliates. 26 All rights reserved.
W3C – The Ultimate Response 
§ Basic XML Schema Patterns for Databinding ~80 
– http://www.w3.org/TR/xmlschema-patterns/ 
– set of rules – “patterns” 
– conforming schemas shall claim best interoperable databinding 
– does not constrain the datamodel, e.g. primitive type representation 
§ Advanced XML Schema Patterns for Databinding ~220 
– these are known to *not* be well supported by some databinding 
frameworks/tools 
– http://www.w3.org/2002/ws/databinding/edcopy/advanced/advanced.html 
Copyright © 2012, Oracle and/or its affiliates. 27 All rights reserved.
W3C – Examples 
<xs:schema /> 
<xs:schema elementFormDefault=“qualified”/> 
@XmlSchema(elementFormDefault=XmlNsForm.QUALIFIED) 
package mypkg; 
<xs:schema elementFormDefault=“unqualified”/> 
@XmlSchema(elementFormDefault=XmlNsForm.UNQUALIFIED) 
package mypkg; 
Copyright © 2012, Oracle and/or its affiliates. 28 All rights reserved.
W3C – Examples 
<xs:schema /> 
<xs:schema attributeFormDefault=“unqualified”/> 
@XmlSchema(attributeFormDefault=XmlNsForm.UNQUALIFIED) 
package mypkg; 
<xs:schema attributeFormDefault=“qualified”/> 
@XmlSchema(attributeFormDefault=XmlNsForm.QUALIFIED) 
package mypkg; 
Copyright © 2012, Oracle and/or its affiliates. 29 All rights reserved.
W3C – Examples 
<xs:annotation> 
<xs:documentation>State Name</xs:documentation> 
</xs:annotation> 
<xs:annotation> 
<xs:documentation>State Name</xs:documentation> 
<xs:appinfo>Application Information</xs:appinfo> 
</xs:annotation> 
Copyright © 2012, Oracle and/or its affiliates. 30 All rights reserved.
W3C – Examples 
§ id=“1” 
§ import/include rules 
§ <xs:element name=“globalEl” type=“xs:string”> 
§ abstract==“false” 
§ … 
§ <xs:element name="non-Identifier-Name“> 
§ abstract==“true” 
§ minOccurs / maxOccurs 
§ … 
Copyright © 2012, Oracle and/or its affiliates. 31 All rights reserved.
Databinding interoperability 
§ Framework Language Passed Skip Fail 
– A Java 401 185 77 
– B Java 455 71 77 
– C Java 531 0 72 
– D C# 483 61 59 
– E Ruby 262 23 318 
– F Python 211 89 303 
– G C 548 1 54 
– H PHP 467 71 65 
– I C++ 465 38 100 
– J Java 448 33 122 
– K Java 499 58 46 
– … 
(source: http://www.w3.org/2002/ws/databinding/edcopy/report/basic.html) 
Copyright © 2012, Oracle and/or its affiliates. 32 All rights reserved.
Databinding interoperability 
(source: http://www.w3.org/2002/ws/databinding/edcopy/report/basic.html) 
Copyright © 2012, Oracle and/or its affiliates. 33 All rights reserved.
Databinding interoperability 
(source: http://www.w3.org/2002/ws/databinding/edcopy/report/basic.html) 
Copyright © 2012, Oracle and/or its affiliates. 34 All rights reserved.
Common-Sense Approach 
Copyright © 2012, Oracle and/or its affiliates. 35 All rights reserved.
Common-Sense Approach 
(JAXB view) 
Copyright © 2012, Oracle and/or its affiliates. 36 All rights reserved.
Common Sense Alternative 
§ No long list of patterns to keep in mind or check against 
§ Keep It Short & Simple 
§ Works both ways 
– Java à Schema 
– Schema à Java 
– Project based decision 
Copyright © 2012, Oracle and/or its affiliates. 37 All rights reserved.
Avoid problematic primitive types 
Copyright © 2012, Oracle and/or its affiliates. 38 All rights reserved. 
anySimpleType 
float decimal double 
integer 
long nonPositiveInteger nonNegativeInteger 
negativeInteger int unsignedLong positiveInteger 
short unsignedInt 
byte unsignedShort 
unsignedByte 
§ Boolean / boolean 
§ Byte / byte 
§ Short / short 
§ Integer / int 
§ Long / long 
§ Double / double 
§ BigInteger*
.NET Mapping 
§ System.Boolean 
§ System.SByte 
§ System.Int16 
§ System.Int32 
§ System.Int64 
§ System.Double 
§ System.UInt64* 
Copyright © 2012, Oracle and/or its affiliates. 39 All rights reserved. 
anySimpleType 
float decimal double 
integer 
long nonPositiveInteger nonNegativeInteger 
negativeInteger int unsignedLong positiveInteger 
short unsignedInt 
byte unsignedShort 
unsignedByte
Be Explicit. Use @XmlSchemaType 
@XmlElement 
@XmlSchemaType(name=“xs:long”) 
public Long lng; 
@XmlElement 
@XmlSchemaType(name=“xs:anyUri”) 
public java.net.URI uri; 
Copyright © 2012, Oracle and/or its affiliates. 40 All rights reserved.
Dates 
java.xml.datatype.XmlGregorianCalendar 
.NET: String 
Java: public XmlGregorianCalendar orderDate; 
XSD:<xs:element name=“orderDate” type=“xs:anySimpleType”/> 
java.util.Date 
java.util.Calendar 
Copyright © 2012, Oracle and/or its affiliates. 41 All rights reserved.
Be Explicit 
§ If direct date mapping required, still use XmlGregorianCalendar 
@XmlSchemaType(name=“dateTime”) 
public XMLGregorianCalendar orderDate; 
§ XSD: <xs:element name=“orderDate” type=“xs:dateTime”/> 
§ .NET: System.DateTime 
Copyright © 2012, Oracle and/or its affiliates. 42 All rights reserved.
Avoid Anonymous types 
<xsd:complexType name="PurchaseOrderType"> 
<xs:element name=“…” type=“ns:SomeOtherType”/> 
@XmlType() 
@XmlType(name=“SomeOtherType”) 
<xsd:complexType name="PurchaseOrderType"> 
… 
<xsd:complexType> … 
@XmlType(name=“”) 
Copyright © 2012, Oracle and/or its affiliates. 43 All rights reserved.
Avoid Mixed Content of Any Type 
<ex:notMixed> 
<ex:notMixedElement>Stuff</ex:notMixedElement> 
</ex:notMixed> 
<ex:mixed> 
<ex:element1>string</ex:element1>mixed content 
<ex:element2>string</ex:element2> 
mixed content 
</ex:mixed> 
@XmlMixed 
Copyright © 2012, Oracle and/or its affiliates. 44 All rights reserved.
Avoid Mixed Content of Any Type 
@XmlElement(name = “var1") 
protected short var1; 
@XmlElement(name = “var2") 
protected double var2; 
… 
@XmlElementRefs({ 
@XmlElementRef(name = “var1", type = JAXBElement.class), 
@XmlElementRef(name = “var2", type = JAXBElement.class), 
}) 
@XmlMixed 
protected List<Serializable> content; 
Copyright © 2012, Oracle and/or its affiliates. 45 All rights reserved.
Avoid substitution groups 
<element name="global" type="string" 
<element name="global-1" type="string" substitutionGroup="tns:global"/> 
<element name="global-2" type="string" substitutionGroup="tns:global"/> 
Copyright © 2012, Oracle and/or its affiliates. 46 All rights reserved.
Don’t Rely on Type Inheritance – by restriction 
<xs:complexType name=“parentType"> 
<xs:sequence> 
<xs:element name=“e1" type="xs:integer" minOccurs="0" maxOccurs="1"/> 
<xs:element name=“e2" type="xs:string" nillable="true" /> 
</xs:sequence> 
<xs:attribute name=“a1" type="xs:date" use="optional" /> 
</xs:complexType> 
<xs:complexType name=“childType"><xs:complexContent> 
<xs:restriction base=“parentType"> 
<xs:sequence> 
<xs:element name=“e1" type="xs:integer" minOccurs="1" /> 
<xs:element name=“e2" type="xs:string" nillable="false" /> 
</xs:sequence> 
<xs:attribute name=“a1" type="xs:date" use="required" /> 
</xs:restriction> 
</xs:complexContent></xs:complexType> 
Copyright © 2012, Oracle and/or its affiliates. 47 All rights reserved.
Common Sense Alternative 
§ Think about datatypes 
§ Be explicit 
§ Use XMLGregorianCalendar 
§ Avoid anonymous types 
§ Avoid mixed content! 
§ Avoid substitution groups 
§ Do not rely on inheritance by restriction 
Copyright © 2012, Oracle and/or its affiliates. 48 All rights reserved.
KEEP IT 
Copyright © 2012, Oracle and/or its affiliates. 49 All rights reserved.
KEEP IT 
Copyright © 2012, Oracle and/or its affiliates. 50 All rights reserved. 
SIMPLE
Common Sense Alternative 
§ http://jaxb.java.net 
§ http://blogs.oracle.com/mgrebac 
§ http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/reference/ 
tutorials/wsit/doc/WSITTutorial.pdf 
§ http://www.w3.org/TR/xmlschema-patterns/ 
§ http://www.w3.org/2002/ws/databinding/edcopy/advanced/advanced.html 
§ http://www.w3.org/2002/ws/databinding/patterns/6/09/ 
§ http://msdn.microsoft.com/en-us/library/ff842400%28d=printer%29.aspx 
§ http://www.infoq.com/articles/schema-for-ws-part1 
§ http://msdn.microsoft.com/en-us/netframework/gg413252 
§ http://www.ibm.com/developerworks/xml/library/ws-tip-j2eenet2/index.html 
§ http://www.ibm.com/developerworks/java/library/ws-tip-j2eenet3/index.html 
Copyright © 2012, Oracle and/or its affiliates. 51 All rights reserved.
Copyright © 2012, Oracle and/or its affiliates. 52 All rights reserved. 
Q 
& 
A
The preceding is intended to outline our general product direction. It is intended 
for information purposes only, and may not be incorporated into any contract. 
It is not a commitment to deliver any material, code, or functionality, and should 
not be relied upon in making purchasing decisions. The development, release, 
and timing of any features or functionality described for Oracle’s products 
remains at the sole discretion of Oracle. 
Copyright © 2012, Oracle and/or its affiliates. 53 All rights reserved.
Copyright © 2012, Oracle and/or its affiliates. 54 All rights reserved.

More Related Content

What's hot

Design Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will PerformDesign Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will Perform
Marco Gralike
 
JDBC Part - 2
JDBC Part - 2JDBC Part - 2
JDBC Part - 2
Hitesh-Java
 
Advance java session 5
Advance java session 5Advance java session 5
Advance java session 5
Smita B Kumar
 
Database Access With JDBC
Database Access With JDBCDatabase Access With JDBC
Database Access With JDBC
Dharani Kumar Madduri
 
JDBC Basics (In 20 Minutes Flat)
JDBC Basics (In 20 Minutes Flat)JDBC Basics (In 20 Minutes Flat)
JDBC Basics (In 20 Minutes Flat)
Craig Dickson
 
Database connect
Database connectDatabase connect
Database connect
Yoga Raja
 
Jstl Guide
Jstl GuideJstl Guide
Jstl Guide
Yuval Zilberstein
 
Hibernate - Part 2
Hibernate - Part 2 Hibernate - Part 2
Hibernate - Part 2
Hitesh-Java
 
Session 24 - JDBC, Intro to Enterprise Java
Session 24 - JDBC, Intro to Enterprise JavaSession 24 - JDBC, Intro to Enterprise Java
Session 24 - JDBC, Intro to Enterprise Java
PawanMM
 
Jdbc example program with access and MySql
Jdbc example program with access and MySqlJdbc example program with access and MySql
Jdbc example program with access and MySql
kamal kotecha
 
JSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESJSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGES
Yoga Raja
 
Xml serialization
Xml serializationXml serialization
Xml serializationRaghu nath
 
JDBC Java Database Connectivity
JDBC Java Database ConnectivityJDBC Java Database Connectivity
JDBC Java Database Connectivity
Ranjan Kumar
 
Java Servlet
Java ServletJava Servlet
Java Servlet
Yoga Raja
 
Xml & Java
Xml & JavaXml & Java
Xml & Java
Slim Ouertani
 

What's hot (19)

Design Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will PerformDesign Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will Perform
 
JDBC Part - 2
JDBC Part - 2JDBC Part - 2
JDBC Part - 2
 
Jdbc[1]
Jdbc[1]Jdbc[1]
Jdbc[1]
 
Advance java session 5
Advance java session 5Advance java session 5
Advance java session 5
 
JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
 
Database Access With JDBC
Database Access With JDBCDatabase Access With JDBC
Database Access With JDBC
 
22jdbc
22jdbc22jdbc
22jdbc
 
JDBC Basics (In 20 Minutes Flat)
JDBC Basics (In 20 Minutes Flat)JDBC Basics (In 20 Minutes Flat)
JDBC Basics (In 20 Minutes Flat)
 
Database connect
Database connectDatabase connect
Database connect
 
Jstl Guide
Jstl GuideJstl Guide
Jstl Guide
 
Jdbc
JdbcJdbc
Jdbc
 
Hibernate - Part 2
Hibernate - Part 2 Hibernate - Part 2
Hibernate - Part 2
 
Session 24 - JDBC, Intro to Enterprise Java
Session 24 - JDBC, Intro to Enterprise JavaSession 24 - JDBC, Intro to Enterprise Java
Session 24 - JDBC, Intro to Enterprise Java
 
Jdbc example program with access and MySql
Jdbc example program with access and MySqlJdbc example program with access and MySql
Jdbc example program with access and MySql
 
JSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESJSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGES
 
Xml serialization
Xml serializationXml serialization
Xml serialization
 
JDBC Java Database Connectivity
JDBC Java Database ConnectivityJDBC Java Database Connectivity
JDBC Java Database Connectivity
 
Java Servlet
Java ServletJava Servlet
Java Servlet
 
Xml & Java
Xml & JavaXml & Java
Xml & Java
 

Similar to Best Practices for Interoperable XML Databinding with JAXB

Ed presents JSF 2.2 at a 2013 Gameduell Tech talk
Ed presents JSF 2.2 at a 2013 Gameduell Tech talkEd presents JSF 2.2 at a 2013 Gameduell Tech talk
Ed presents JSF 2.2 at a 2013 Gameduell Tech talkEdward Burns
 
Java SE 8
Java SE 8Java SE 8
Java SE 8
Simon Ritter
 
JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap...
JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap...JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap...
JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap...
harvraja
 
GlassFish in Production Environments
GlassFish in Production EnvironmentsGlassFish in Production Environments
GlassFish in Production Environments
Bruno Borges
 
Node.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development TechniquesNode.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development Techniques
Christopher Jones
 
ADBA (Asynchronous Database Access)
ADBA (Asynchronous Database Access)ADBA (Asynchronous Database Access)
ADBA (Asynchronous Database Access)
Logico
 
10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 201310 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013Martin Fousek
 
pre-FOSDEM MySQL day, February 2018 - MySQL Document Store
pre-FOSDEM MySQL day, February 2018 - MySQL Document Storepre-FOSDEM MySQL day, February 2018 - MySQL Document Store
pre-FOSDEM MySQL day, February 2018 - MySQL Document Store
Frederic Descamps
 
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...
Olivier DASINI
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
Mert Çalışkan
 
Looking Inside the MySQL 8.0 Document Store
Looking Inside the MySQL 8.0 Document StoreLooking Inside the MySQL 8.0 Document Store
Looking Inside the MySQL 8.0 Document Store
Frederic Descamps
 
Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Have You Seen Java EE Lately?
Have You Seen Java EE Lately?
Reza Rahman
 
Programming-best practices( beginner) ADF_fusionapps
Programming-best practices( beginner) ADF_fusionappsProgramming-best practices( beginner) ADF_fusionapps
Programming-best practices( beginner) ADF_fusionapps
Berry Clemens
 
Ebs troubleshooting con9019_pdf_9019_0001
Ebs troubleshooting con9019_pdf_9019_0001Ebs troubleshooting con9019_pdf_9019_0001
Ebs troubleshooting con9019_pdf_9019_0001jucaab
 
Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.
Edward Burns
 
Lambdas and-streams-s ritter-v3
Lambdas and-streams-s ritter-v3Lambdas and-streams-s ritter-v3
Lambdas and-streams-s ritter-v3
Simon Ritter
 
Oracle ADF Architecture TV - Development - Programming Best Practices
Oracle ADF Architecture TV - Development - Programming Best PracticesOracle ADF Architecture TV - Development - Programming Best Practices
Oracle ADF Architecture TV - Development - Programming Best Practices
Chris Muir
 
ADF Mobile: Implementing Data Caching and Synching
ADF Mobile: Implementing Data Caching and SynchingADF Mobile: Implementing Data Caching and Synching
ADF Mobile: Implementing Data Caching and Synching
Steven Davelaar
 
Diagnosing Your Application on the JVM
Diagnosing Your Application on the JVMDiagnosing Your Application on the JVM
Diagnosing Your Application on the JVM
Staffan Larsen
 

Similar to Best Practices for Interoperable XML Databinding with JAXB (20)

Ed presents JSF 2.2 at a 2013 Gameduell Tech talk
Ed presents JSF 2.2 at a 2013 Gameduell Tech talkEd presents JSF 2.2 at a 2013 Gameduell Tech talk
Ed presents JSF 2.2 at a 2013 Gameduell Tech talk
 
Java SE 8
Java SE 8Java SE 8
Java SE 8
 
JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap...
JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap...JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap...
JavaOne-2013: Save Scarce Resources by Managing Terabytes of Objects off-heap...
 
GlassFish in Production Environments
GlassFish in Production EnvironmentsGlassFish in Production Environments
GlassFish in Production Environments
 
Node.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development TechniquesNode.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development Techniques
 
ADBA (Asynchronous Database Access)
ADBA (Asynchronous Database Access)ADBA (Asynchronous Database Access)
ADBA (Asynchronous Database Access)
 
10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 201310 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
 
pre-FOSDEM MySQL day, February 2018 - MySQL Document Store
pre-FOSDEM MySQL day, February 2018 - MySQL Document Storepre-FOSDEM MySQL day, February 2018 - MySQL Document Store
pre-FOSDEM MySQL day, February 2018 - MySQL Document Store
 
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
 
Looking Inside the MySQL 8.0 Document Store
Looking Inside the MySQL 8.0 Document StoreLooking Inside the MySQL 8.0 Document Store
Looking Inside the MySQL 8.0 Document Store
 
Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Have You Seen Java EE Lately?
Have You Seen Java EE Lately?
 
Programming-best practices( beginner) ADF_fusionapps
Programming-best practices( beginner) ADF_fusionappsProgramming-best practices( beginner) ADF_fusionapps
Programming-best practices( beginner) ADF_fusionapps
 
Ebs troubleshooting con9019_pdf_9019_0001
Ebs troubleshooting con9019_pdf_9019_0001Ebs troubleshooting con9019_pdf_9019_0001
Ebs troubleshooting con9019_pdf_9019_0001
 
Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.
 
Lambdas and-streams-s ritter-v3
Lambdas and-streams-s ritter-v3Lambdas and-streams-s ritter-v3
Lambdas and-streams-s ritter-v3
 
Oracle ADF Architecture TV - Development - Programming Best Practices
Oracle ADF Architecture TV - Development - Programming Best PracticesOracle ADF Architecture TV - Development - Programming Best Practices
Oracle ADF Architecture TV - Development - Programming Best Practices
 
ADF Mobile: Implementing Data Caching and Synching
ADF Mobile: Implementing Data Caching and SynchingADF Mobile: Implementing Data Caching and Synching
ADF Mobile: Implementing Data Caching and Synching
 
Cloud based database
Cloud based databaseCloud based database
Cloud based database
 
Diagnosing Your Application on the JVM
Diagnosing Your Application on the JVMDiagnosing Your Application on the JVM
Diagnosing Your Application on the JVM
 

Recently uploaded

Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 

Recently uploaded (20)

Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 

Best Practices for Interoperable XML Databinding with JAXB

  • 1. Copyright © 2012, Oracle and/or its affiliates. 1 All rights reserved.
  • 2. Best Practices for Interoperable XML Databinding with JAXB Martin Grebac, SW Engineering Manager, Oracle (Project METRO)
  • 3. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. Copyright © 2012, Oracle and/or its affiliates. 3 All rights reserved.
  • 4. Program Agenda § Quick intro § Why? The Reasoning § General Limitations & W3C approach § Common-sense approach – Complexities to avoid – The safe intersection – Examples Copyright © 2012, Oracle and/or its affiliates. 4 All rights reserved.
  • 5. Quick Intro Copyright © 2012, Oracle and/or its affiliates. 5 All rights reserved.
  • 6. “XML data binding refers to a means of representing information in an XML document as an object in computer memory.” Wikipedia <Item ItemNumber="2"> <Part PartNumber="456"> <Description> bla bla…</Description> <Price>13.27</Price> </Part> <Quantity>5</Quantity> </Item> Copyright © 2012, Oracle and/or its affiliates. 6 All rights reserved. Item ItemNumber: 2 Quantity: 5 Part PartNumber: 456 Description: bla bla … Price: 13.27
  • 7. XML DataBinding – Where to Find § Direct – Direct use of JAXB or other Databinding APIs § Indirect – Web Services, JAX-WS, Jersey, REST, … § Based on grammar (XML Schema, DTD, RelaxNG, …) – Classes usually represent the schema structures – Instances represent content of XML document – Schema feature set is large Copyright © 2012, Oracle and/or its affiliates. 7 All rights reserved.
  • 8. WHY? - The Reasoning Copyright © 2012, Oracle and/or its affiliates. 8 All rights reserved.
  • 9. Number of XML Databinding frameworks § Axis § .NET § IBM RAD § Mono § gSOAP2 § Castor § WCF § JAXB § XBinder Copyright © 2012, Oracle and/or its affiliates. 9 All rights reserved. § SOAP4R § Spring § Castor § Xbinder § Xfire § ZSI § XMLBeans § PHP § ADB § …
  • 10. Common XML Databinding Framework Limitations § Round-trip limitations – Sibling Order – Physical Structure – Comments and Processing Instructions – XML Declaration § Feature limitations – Incomplete schema support – Transformations – Document Fragment support Copyright © 2012, Oracle and/or its affiliates. 10 All rights reserved.
  • 11. Common XML Databinding Framework Limitations § Round-trip limitations – Sibling Order – Physical Structure – Comments and Processing Instructions – XML Declaration § Feature limitations – à Incomplete schema support – Transformations – Document Fragment support Copyright © 2012, Oracle and/or its affiliates. 11 All rights reserved.
  • 12. Do you start from schema? Copyright © 2012, Oracle and/or its affiliates. 12 All rights reserved. XML Schema
  • 13. Do you start from schema? Copyright © 2012, Oracle and/or its affiliates. 13 All rights reserved. XML Schema XML Document
  • 14. Do you start from schema? Copyright © 2012, Oracle and/or its affiliates. 14 All rights reserved. XML Document Databinding / Web Service framework 1 Objects XML Schema Limited support
  • 15. Or do you start from classes? Copyright © 2012, Oracle and/or its affiliates. 15 All rights reserved. XML Document Databinding / Web Service framework 2 Databinding / Web Service framework 1 Objects Objects XML Schema Limited support Databinding / Web Service framework 3 Objects Limited support
  • 16. Or do you start from classes? Copyright © 2012, Oracle and/or its affiliates. 16 All rights reserved. Objects
  • 17. Or do you start from classes? Copyright © 2012, Oracle and/or its affiliates. 17 All rights reserved. XML Document Databinding / Web Service framework 1 Objects
  • 18. Or do you start from classes? Copyright © 2012, Oracle and/or its affiliates. 18 All rights reserved. XML Document Databinding / Web Service framework 1 Objects XML Schema
  • 19. Or do you start from classes? Copyright © 2012, Oracle and/or its affiliates. 19 All rights reserved. XML Document Databinding / Web Service framework 1 Objects XML Schema
  • 20. Or do you start from classes? Copyright © 2012, Oracle and/or its affiliates. 20 All rights reserved. XML Document Databinding / Web Service framework 2 Databinding / Web Service framework 1 Objects Objects XML Schema Limited support
  • 21. Or do you start from classes? Copyright © 2012, Oracle and/or its affiliates. 21 All rights reserved. XML Document Databinding / Web Service framework 2 Databinding / Web Service framework 1 Objects Objects XML Schema Limited support Databinding / Web Service framework 3 Objects Limited support
  • 22. Number of XML Databinding frameworks § Axis § .NET § IBM RAD § Mono § gSOAP2 § Castor § WCF § JAXB § XBinder Copyright © 2012, Oracle and/or its affiliates. 22 All rights reserved. § SOAP4R § Spring § Castor § Xbinder § Xfire § ZSI § XMLBeans § PHP § ADB § …
  • 23. LOOKS PRETTY BAD … Copyright © 2012, Oracle and/or its affiliates. 23 All rights reserved.
  • 24. LOOKS PRETTY BAD … … I’M DEPRESSED. Copyright © 2012, Oracle and/or its affiliates. 24 All rights reserved.
  • 25. LOOKS PRETTY BAD … … I’M DEPRESSED. NOW WHAT? Copyright © 2012, Oracle and/or its affiliates. 25 All rights reserved.
  • 26. Now what? The W3C Approach Copyright © 2012, Oracle and/or its affiliates. 26 All rights reserved.
  • 27. W3C – The Ultimate Response § Basic XML Schema Patterns for Databinding ~80 – http://www.w3.org/TR/xmlschema-patterns/ – set of rules – “patterns” – conforming schemas shall claim best interoperable databinding – does not constrain the datamodel, e.g. primitive type representation § Advanced XML Schema Patterns for Databinding ~220 – these are known to *not* be well supported by some databinding frameworks/tools – http://www.w3.org/2002/ws/databinding/edcopy/advanced/advanced.html Copyright © 2012, Oracle and/or its affiliates. 27 All rights reserved.
  • 28. W3C – Examples <xs:schema /> <xs:schema elementFormDefault=“qualified”/> @XmlSchema(elementFormDefault=XmlNsForm.QUALIFIED) package mypkg; <xs:schema elementFormDefault=“unqualified”/> @XmlSchema(elementFormDefault=XmlNsForm.UNQUALIFIED) package mypkg; Copyright © 2012, Oracle and/or its affiliates. 28 All rights reserved.
  • 29. W3C – Examples <xs:schema /> <xs:schema attributeFormDefault=“unqualified”/> @XmlSchema(attributeFormDefault=XmlNsForm.UNQUALIFIED) package mypkg; <xs:schema attributeFormDefault=“qualified”/> @XmlSchema(attributeFormDefault=XmlNsForm.QUALIFIED) package mypkg; Copyright © 2012, Oracle and/or its affiliates. 29 All rights reserved.
  • 30. W3C – Examples <xs:annotation> <xs:documentation>State Name</xs:documentation> </xs:annotation> <xs:annotation> <xs:documentation>State Name</xs:documentation> <xs:appinfo>Application Information</xs:appinfo> </xs:annotation> Copyright © 2012, Oracle and/or its affiliates. 30 All rights reserved.
  • 31. W3C – Examples § id=“1” § import/include rules § <xs:element name=“globalEl” type=“xs:string”> § abstract==“false” § … § <xs:element name="non-Identifier-Name“> § abstract==“true” § minOccurs / maxOccurs § … Copyright © 2012, Oracle and/or its affiliates. 31 All rights reserved.
  • 32. Databinding interoperability § Framework Language Passed Skip Fail – A Java 401 185 77 – B Java 455 71 77 – C Java 531 0 72 – D C# 483 61 59 – E Ruby 262 23 318 – F Python 211 89 303 – G C 548 1 54 – H PHP 467 71 65 – I C++ 465 38 100 – J Java 448 33 122 – K Java 499 58 46 – … (source: http://www.w3.org/2002/ws/databinding/edcopy/report/basic.html) Copyright © 2012, Oracle and/or its affiliates. 32 All rights reserved.
  • 33. Databinding interoperability (source: http://www.w3.org/2002/ws/databinding/edcopy/report/basic.html) Copyright © 2012, Oracle and/or its affiliates. 33 All rights reserved.
  • 34. Databinding interoperability (source: http://www.w3.org/2002/ws/databinding/edcopy/report/basic.html) Copyright © 2012, Oracle and/or its affiliates. 34 All rights reserved.
  • 35. Common-Sense Approach Copyright © 2012, Oracle and/or its affiliates. 35 All rights reserved.
  • 36. Common-Sense Approach (JAXB view) Copyright © 2012, Oracle and/or its affiliates. 36 All rights reserved.
  • 37. Common Sense Alternative § No long list of patterns to keep in mind or check against § Keep It Short & Simple § Works both ways – Java à Schema – Schema à Java – Project based decision Copyright © 2012, Oracle and/or its affiliates. 37 All rights reserved.
  • 38. Avoid problematic primitive types Copyright © 2012, Oracle and/or its affiliates. 38 All rights reserved. anySimpleType float decimal double integer long nonPositiveInteger nonNegativeInteger negativeInteger int unsignedLong positiveInteger short unsignedInt byte unsignedShort unsignedByte § Boolean / boolean § Byte / byte § Short / short § Integer / int § Long / long § Double / double § BigInteger*
  • 39. .NET Mapping § System.Boolean § System.SByte § System.Int16 § System.Int32 § System.Int64 § System.Double § System.UInt64* Copyright © 2012, Oracle and/or its affiliates. 39 All rights reserved. anySimpleType float decimal double integer long nonPositiveInteger nonNegativeInteger negativeInteger int unsignedLong positiveInteger short unsignedInt byte unsignedShort unsignedByte
  • 40. Be Explicit. Use @XmlSchemaType @XmlElement @XmlSchemaType(name=“xs:long”) public Long lng; @XmlElement @XmlSchemaType(name=“xs:anyUri”) public java.net.URI uri; Copyright © 2012, Oracle and/or its affiliates. 40 All rights reserved.
  • 41. Dates java.xml.datatype.XmlGregorianCalendar .NET: String Java: public XmlGregorianCalendar orderDate; XSD:<xs:element name=“orderDate” type=“xs:anySimpleType”/> java.util.Date java.util.Calendar Copyright © 2012, Oracle and/or its affiliates. 41 All rights reserved.
  • 42. Be Explicit § If direct date mapping required, still use XmlGregorianCalendar @XmlSchemaType(name=“dateTime”) public XMLGregorianCalendar orderDate; § XSD: <xs:element name=“orderDate” type=“xs:dateTime”/> § .NET: System.DateTime Copyright © 2012, Oracle and/or its affiliates. 42 All rights reserved.
  • 43. Avoid Anonymous types <xsd:complexType name="PurchaseOrderType"> <xs:element name=“…” type=“ns:SomeOtherType”/> @XmlType() @XmlType(name=“SomeOtherType”) <xsd:complexType name="PurchaseOrderType"> … <xsd:complexType> … @XmlType(name=“”) Copyright © 2012, Oracle and/or its affiliates. 43 All rights reserved.
  • 44. Avoid Mixed Content of Any Type <ex:notMixed> <ex:notMixedElement>Stuff</ex:notMixedElement> </ex:notMixed> <ex:mixed> <ex:element1>string</ex:element1>mixed content <ex:element2>string</ex:element2> mixed content </ex:mixed> @XmlMixed Copyright © 2012, Oracle and/or its affiliates. 44 All rights reserved.
  • 45. Avoid Mixed Content of Any Type @XmlElement(name = “var1") protected short var1; @XmlElement(name = “var2") protected double var2; … @XmlElementRefs({ @XmlElementRef(name = “var1", type = JAXBElement.class), @XmlElementRef(name = “var2", type = JAXBElement.class), }) @XmlMixed protected List<Serializable> content; Copyright © 2012, Oracle and/or its affiliates. 45 All rights reserved.
  • 46. Avoid substitution groups <element name="global" type="string" <element name="global-1" type="string" substitutionGroup="tns:global"/> <element name="global-2" type="string" substitutionGroup="tns:global"/> Copyright © 2012, Oracle and/or its affiliates. 46 All rights reserved.
  • 47. Don’t Rely on Type Inheritance – by restriction <xs:complexType name=“parentType"> <xs:sequence> <xs:element name=“e1" type="xs:integer" minOccurs="0" maxOccurs="1"/> <xs:element name=“e2" type="xs:string" nillable="true" /> </xs:sequence> <xs:attribute name=“a1" type="xs:date" use="optional" /> </xs:complexType> <xs:complexType name=“childType"><xs:complexContent> <xs:restriction base=“parentType"> <xs:sequence> <xs:element name=“e1" type="xs:integer" minOccurs="1" /> <xs:element name=“e2" type="xs:string" nillable="false" /> </xs:sequence> <xs:attribute name=“a1" type="xs:date" use="required" /> </xs:restriction> </xs:complexContent></xs:complexType> Copyright © 2012, Oracle and/or its affiliates. 47 All rights reserved.
  • 48. Common Sense Alternative § Think about datatypes § Be explicit § Use XMLGregorianCalendar § Avoid anonymous types § Avoid mixed content! § Avoid substitution groups § Do not rely on inheritance by restriction Copyright © 2012, Oracle and/or its affiliates. 48 All rights reserved.
  • 49. KEEP IT Copyright © 2012, Oracle and/or its affiliates. 49 All rights reserved.
  • 50. KEEP IT Copyright © 2012, Oracle and/or its affiliates. 50 All rights reserved. SIMPLE
  • 51. Common Sense Alternative § http://jaxb.java.net § http://blogs.oracle.com/mgrebac § http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/reference/ tutorials/wsit/doc/WSITTutorial.pdf § http://www.w3.org/TR/xmlschema-patterns/ § http://www.w3.org/2002/ws/databinding/edcopy/advanced/advanced.html § http://www.w3.org/2002/ws/databinding/patterns/6/09/ § http://msdn.microsoft.com/en-us/library/ff842400%28d=printer%29.aspx § http://www.infoq.com/articles/schema-for-ws-part1 § http://msdn.microsoft.com/en-us/netframework/gg413252 § http://www.ibm.com/developerworks/xml/library/ws-tip-j2eenet2/index.html § http://www.ibm.com/developerworks/java/library/ws-tip-j2eenet3/index.html Copyright © 2012, Oracle and/or its affiliates. 51 All rights reserved.
  • 52. Copyright © 2012, Oracle and/or its affiliates. 52 All rights reserved. Q & A
  • 53. The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. Copyright © 2012, Oracle and/or its affiliates. 53 All rights reserved.
  • 54. Copyright © 2012, Oracle and/or its affiliates. 54 All rights reserved.