The blog post covers the basics. If you don't control the Web Service and so can't add your annotations then there's a technique where you use "xjb" to modify the generated source that you create using wsimport.
One issue you will typically find is that there isn't really a "standard" when it comes to webservices - every webservice seems to be ever so slightly different to each other. Date Times with or without time and time zone is often a point of different despite the the "standards". ---XeroCustomBindings.xjb <?xml version="1.0" encoding="UTF-8"?> <jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" version="2.0" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"> <!-- Using bindings xjc -classpath /Users/rperfect/IdeaProjects/DataZime/XeroClient/build/classes -p com.xero.domain -b XeroCustomBindings.xjb -d gen-src *.xsd --> <jaxb:globalBindings> <jaxb:javaType name="org.joda.time.DateTime" xmlType="xs:date" parseMethod="com.datazime.connector.xero.client.DateAdapter.parseDate" printMethod="com.datazime.connector.xero.client.DateAdapter.printDate" /> <jaxb:javaType name="org.joda.time.DateTime" xmlType="xs:dateTime" parseMethod="com.datazime.connector.xero.client.DateAdapter.parseDatetim e" printMethod="com.datazime.connector.xero.client.DateAdapter.printDatetim e" /> <xjc:simple /> </jaxb:globalBindings> </jaxb:bindings> package com.datazime.connector.xero.client; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.ISODateTimeFormat; /** */ public class DateAdapter { private static final DateTimeFormatter XML_DATE_FORMAT = ISODateTimeFormat.dateTimeNoMillis(); private static final DateTimeFormatter XML_DATE_TIME_FORMAT = ISODateTimeFormat.localDateOptionalTimeParser(); private static final DateTimeFormatter DATE_PATTERN = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSS"); public static DateTime parseDatetime(String dateStr) { DateTime result = XML_DATE_TIME_FORMAT.parseDateTime(dateStr); return result; } public static String printDatetime(DateTime date) { String result = DATE_PATTERN.print(date); return result; } public static DateTime parseDate(String dateStr) { DateTime result = XML_DATE_FORMAT.parseDateTime(dateStr); return result; } public static String printDate(DateTime date) { String result = DATE_PATTERN.print(date); return result; } } -----Original Message----- From: Stephen Colebourne [mailto:scolebou...@joda.org] Sent: Tuesday, 27 September 2011 9:39 a.m. To: Discussion of the Joda project Subject: Re: [Joda-interest] @XmlElement I've never used JAXB myself, nor have I heard of anyone doing an integration library, so that blog post is probably the state of the art. Stephen On 26 September 2011 21:06, Mark Carroll <mark.carr...@vecna.com> wrote: > I was converting some code to use a DateTime instead of a Date and a > property has an @XmlElement annotation. Having apparently stumbled on > to a web service, some Googling eventually found me > http://blog.bdoughan.com/2011/05/jaxb-and-joda-time-dates-and-times.ht > ml > > Is that kind of thing presently the recommended approach? Is there > some semi-standard library we should be using or should I just roll my > own marshaller? > > Mark > > -- > Mark Carroll > Software Engineer > mark.carr...@vecna.com > http://www.vecna.com/ > > Cambridge Research Laboratory > Vecna Technologies, Inc. > 36 Cambridge Park Drive > Cambridge, MA 02140 > Phone: (617) 864-0636 > Fax: (617) 864-0638 > > Better Technology, Better World (TM) > > The contents of this message may be privileged and confidential. > Therefore, if this message has been received in error, please delete > it without reading it. Your receipt of this message is not intended to > waive any applicable privilege. Please do not disseminate this message > without the permission of the author. > > ---------------------------------------------------------------------- > -------- All the data continuously generated in your IT infrastructure > contains a definitive record of customers, application performance, > security threats, fraudulent activity and more. Splunk takes this data > and makes sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Joda-interest mailing list > Joda-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/joda-interest > ------------------------------------------------------------------------ ------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest "This e-mail and any attachments to it (the "Communication") is, unless otherwise stated, confidential, may contain copyright material and is for the use only of the intended recipient. If you receive the Communication in error, please notify the sender immediately by return e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit or otherwise deal with it. Any views expressed in the Communication are those of the individual sender only, unless expressly stated to be those of Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or any of its related entities including ANZ National Bank Limited (together "ANZ"). ANZ does not accept liability in connection with the integrity of or errors in the Communication, computer virus, data corruption, interference or delay arising from or in respect of the Communication." ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest