You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Still Fetalvero <rf...@gmail.com> on 2009/06/11 03:24:46 UTC
Re: Problem with Dates in web service
The code actually fails when using JAXB 2.0.5 and it occurs for JAXB classes
that extend java.util.Date.
Maaku wrote:
>
> I was able to marshal successfully, so the problem might be in cxf?
>
> public class Tester {
> public static void main(String[] args) throws JAXBException {
> JAXBContext jaxbContext = JAXBContext.newInstance(Date2.class);
> // Marshal to System.out
> Marshaller marshaller = jaxbContext.createMarshaller();
> marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
> Boolean.TRUE);
> Date2 date2 = new Date2();
> date2.setTest("testing...");
> marshaller.marshal( date2, System.out );
> }
> }
>
> @XmlRootElement
> public class Date2 extends Date {
> public Date2() {
> super();
> }
> private String test;
> public String getTest() {
> return test;
> }
> public void setTest(String test) {
> this.test = test;
> }
> }
>
--
View this message in context: http://www.nabble.com/Problem-with-Dates-in-web-service-tp23716455p23973847.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: Problem with Dates in web service
Posted by Still Fetalvero <rf...@gmail.com>.
Also when using JAXB (RI 2.1.9) value of member Date is marshalled not the
value of the parent Date.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<date2>
<memberDate>2009-02-11T10:04:26.296+08:00</memberDate>
</date2>
Still Fetalvero wrote:
>
> The code actually fails when using JAXB 2.0.5 and it occurs for JAXB
> classes that extend java.util.Date.
>
> Maaku wrote:
>>
>> I was able to marshal successfully, so the problem might be in cxf?
>>
>> public class Tester {
>> public static void main(String[] args) throws JAXBException {
>> JAXBContext jaxbContext =
>> JAXBContext.newInstance(Date2.class);
>> // Marshal to System.out
>> Marshaller marshaller = jaxbContext.createMarshaller();
>> marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
>> Boolean.TRUE);
>> Date2 date2 = new Date2();
>> date2.setTest("testing...");
>> marshaller.marshal( date2, System.out );
>> }
>> }
>>
>> @XmlRootElement
>> public class Date2 extends Date {
>> public Date2() {
>> super();
>> }
>> private String test;
>> public String getTest() {
>> return test;
>> }
>> public void setTest(String test) {
>> this.test = test;
>> }
>> }
>>
>
>
--
View this message in context: http://www.nabble.com/Problem-with-Dates-in-web-service-tp23716455p23974167.html
Sent from the OpenEJB User mailing list archive at Nabble.com.