DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16800>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16800 simpleTypes based on date/dateTime serialization problems (wsdl2java) Summary: simpleTypes based on date/dateTime serialization problems (wsdl2java) Product: Axis Version: 1.0 Platform: All OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: WSDL processing AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I think there's a problem with serialization of simple types defined as restrictions of date or dateTime. eg, <simpleType name="MySimpleDate"> <restriction base="date"/> </simpleType> The problem is that when serialized, the format sent over the wire is just the java.util.Date.toString() value, and de-serialization is performed using java.text.DateFormat.getDateTimeInstance().parse(). The problems here are that the two formats are incompatible, resulting in ParseExceptions, and the wire format isn't as defined by XML Schema. It results in effects like this: java.text.ParseException: Unparseable date: "Fri May 06 11:41:57 BST 2005" (for dateTime, similar processing is performed on Calendar; the Calendar.toString() format is even wackier of course). ------------------- I have a rough patched version of org.apache.axis.wsdl.toJava.JavaBeanWriter which I am using to overcome this. I don't believe I understand all the code well enough to be sure it's the best fix (mainly because JavaBeanWriter has code specifically for Date/Calendar but I can't see how it could work - so maybe I'm missing the point somewhere), but basically I generate code like this in the MySimpleDate.java file: private static java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd"); public MySimpleDate(java.lang.String value) { try { this.value = sdf.parse(value); } catch (java.text.ParseException e){ throw new java.lang.RuntimeException(e.toString()); } } public java.lang.String toString() { return value == null ? null : sdf.format(value); } And somewhat similar code for dateTime-based types, but operating on a Calendar with an appropriate SimpleDateFormat. Regards, Dave Woolaway
