A quick note, which extends the use of web services such as JAX-WS when they use types of dates.
dates are relatively common in data management applications: weird dates have not generally need a precision to the millisecond. Personally, I always struggle to understand how age with ten years of Java can be as complicated as a basic functionality.
Recently, I discovered that for a specified date in the WSDL type xml xsd: date, were obtained with the utility of jBoss wsconsume XMLGregorianCalendar Java type. This also seems to be the standard for web services.
Given the difficulties encountered to make a type java.util.Date, I preferred to share this information. Either a
dateWSNaissance XMLGregorianCalendar from my Web Service.
For its value to type Date: Date myDate =
dateWSNaissance (). ToGregorianCalendar (). GetTime ();
In the return direction, to transform a date XMLGregorianCalendar is longer:
GregorianCalendar = new GregorianCalendar GCalendar ();
gCalendar.setTime (myDate);
dateWSNaissance DatatypeFactory.newInstance = (). NewXMLGregorianCalendar (GCalendar)
That's it for this post.
I recall the address of my tutorial on web services with JAX-WS: Tutorial Web Service with JBoss 4.2 .
I also have a long tutorial on the 7-step implementation of web services with Axis2, which begins with this note: Web Services with Axis2 Tutorial: Contract First Approach
0 comments:
Post a Comment