Is having an XSD considered good practice when passing XML marshalled objects across the wire? -


i'm using mix of jaxb, jpa, , restful web service pass objects across wire. domain objects contain mix of jpa , jaxb annotations, , i'm able unmarshall domain objects using spring's resttemplate minimum amount of code. remember reading not long ago (may have been answer on so, may have been blog) author argued never rely on annotations in production environment, marshall , unmarshall according schema. still necessary practice?

if have .jar annotated beans dependency in 2 projects (e.g. producing restful web service , consuming client), wouldn't introducing generated xsds add set of data requiring maintenance? when using annotated jaxb pojos, when schemas necessary , benefit provide?

jaxb represents metadata annotations there no marshal/unmarshal according xml schema.

i lead jaxb component (moxy) of eclipselink, best know jpa implementation. recommendation developers use combination of jaxb & jpa annotations on model.

uses of xml schema:

  • as mentioned biziclop jaxb can leverage xml schema during marshal/unmarshal operations perform validation.
  • the xml schema provides means clients of restful service know expected xml message looks like. mentioned fabian steeg can make schema easier maintain having created part of build.

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -