You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Joshua White <ge...@gmail.com> on 2007/03/07 14:21:30 UTC

[Axis 1.4.x] How to handle java.util.Date

Hello,

I am having trouble with serializing/deserializing dates.  I am having axis
serialiaze a simple java bean that contains a java.util.Date.  When the wsdl
is generated, it appears as a xsd:dateTime.  As you know, when you generate
the client, this appears as a java.util.Calendar on the client side.

The problem that I am having is that when the client sends a date (using
java.util.Calendar), it is not being deserialized into a
java.util.Datecorrectly on the serverside.  Is there a way to specify
java.util.Dates to be mapped to xsd:date instead of xsd:dateTime?  I found
that if I edit the WSDL file manually and chance the datatype to xsd:date
everything works fine.

What is the best way to do this?

Josh

RE: [Axis 1.4.x] How to handle java.util.Date

Posted by "Rasile, Rob" <ro...@ethoca.com>.
Hey Joshua.  JibX is in fact included in Axis2... but in itself is a
standalone xml data binding API.  Not sure about it's support in 1.4.

 

If you do want more info on it you can read about it here:
http://ws.apache.org/axis2/1_1_1/userguide-creatingclients.html#createcl
ients  under "Choosing a Client Generation Method".

Also, there's http://jibx.sourceforge.net/ for more info and tutorials.
You'd probably be able to adapt it to 1.4... 

 

I'm using jibx extensively now with XMLGregorianCalendars (because I had
the same issues as you've had with java.util.Date/Calendar etc).

 

 

________________________________

From: Joshua White [mailto:gemini929@gmail.com] 
Sent: Wednesday, March 07, 2007 9:13 AM
To: axis-user@ws.apache.org
Subject: Re: [Axis 1.4.x] How to handle java.util.Date

 

Rob,

 

Thanks for the reply.  Is jibx data-binding a Axis 2 feature?

 

Joshua

 

On 3/7/07, Rasile, Rob <ro...@ethoca.com> wrote: 

Couple of options here... 

 

First, if you use jibx data-binding you can explicitly define your
mappings - so you can directly go from xsd:dateTime to java types.  You
can even go so far as to write your own custome serializer/deserializer.


Second, try using a javax.xml.datatype.XMLGregorianCalendar rather that
java.util.Calendar from the client.  

 

________________________________

From: Joshua White [mailto: gemini929@gmail.com] 
Sent: Wednesday, March 07, 2007 8:22 AM 
To: axis-user
Subject: [Axis 1.4.x] How to handle java.util.Date

 

Hello,

 

I am having trouble with serializing/deserializing dates.  I am having
axis serialiaze a simple java bean that contains a java.util.Date.  When
the wsdl is generated, it appears as a xsd:dateTime.  As you know, when
you generate the client, this appears as a java.util.Calendar on the
client side.  

 

The problem that I am having is that when the client sends a date (using
java.util.Calendar), it is not being deserialized into a java.util.Date
correctly on the serverside.  Is there a way to specify java.util.Dates
to be mapped to xsd:date instead of xsd:dateTime?  I found that if I
edit the WSDL file manually and chance the datatype to xsd:date
everything works fine.

 

What is the best way to do this?

 

Josh

 

 


Re: [Axis 1.4.x] How to handle java.util.Date

Posted by Joshua White <ge...@gmail.com>.
Rob,

Thanks for the reply.  Is jibx data-binding a Axis 2 feature?

Joshua


On 3/7/07, Rasile, Rob <ro...@ethoca.com> wrote:
>
>  Couple of options here…
>
>
>
> First, if you use jibx data-binding you can explicitly define your
> mappings – so you can directly go from xsd:dateTime to java types.  You can
> even go so far as to write your own custome serializer/deserializer.
>
> Second, try using a javax.xml.datatype.XMLGregorianCalendar rather that
> java.util.Calendar from the client.
>
>
>  ------------------------------
>
> *From:* Joshua White [mailto:gemini929@gmail.com]
> *Sent:* Wednesday, March 07, 2007 8:22 AM
> *To:* axis-user
> *Subject:* [Axis 1.4.x] How to handle java.util.Date
>
>
>
> Hello,
>
>
>
> I am having trouble with serializing/deserializing dates.  I am having
> axis serialiaze a simple java bean that contains a java.util.Date.  When
> the wsdl is generated, it appears as a xsd:dateTime.  As you know, when you
> generate the client, this appears as a java.util.Calendar on the client
> side.
>
>
>
> The problem that I am having is that when the client sends a date (using
> java.util.Calendar), it is not being deserialized into a java.util.Datecorrectly on the serverside.  Is there a way to specify
> java.util.Dates to be mapped to xsd:date instead of xsd:dateTime?  I found
> that if I edit the WSDL file manually and chance the datatype to xsd:date
> everything works fine.
>
>
>
> What is the best way to do this?
>
>
>
> Josh
>
>
>

RE: [Axis 1.4.x] How to handle java.util.Date

Posted by "Rasile, Rob" <ro...@ethoca.com>.
Couple of options here... 

 

First, if you use jibx data-binding you can explicitly define your
mappings - so you can directly go from xsd:dateTime to java types.  You
can even go so far as to write your own custome serializer/deserializer.


Second, try using a javax.xml.datatype.XMLGregorianCalendar rather that
java.util.Calendar from the client.  

 

________________________________

From: Joshua White [mailto:gemini929@gmail.com] 
Sent: Wednesday, March 07, 2007 8:22 AM
To: axis-user
Subject: [Axis 1.4.x] How to handle java.util.Date

 

Hello,

 

I am having trouble with serializing/deserializing dates.  I am having
axis serialiaze a simple java bean that contains a java.util.Date.  When
the wsdl is generated, it appears as a xsd:dateTime.  As you know, when
you generate the client, this appears as a java.util.Calendar on the
client side.  

 

The problem that I am having is that when the client sends a date (using
java.util.Calendar), it is not being deserialized into a java.util.Date
correctly on the serverside.  Is there a way to specify java.util.Dates
to be mapped to xsd:date instead of xsd:dateTime?  I found that if I
edit the WSDL file manually and chance the datatype to xsd:date
everything works fine.

 

What is the best way to do this?

 

Josh