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 Suresh Koya <su...@yahoo.com> on 2007/06/26 01:23:00 UTC

datetime handling in Axis!

Hi,

  I am using axis 2.0. I have facing some issues with the datetime handling of axis. It looks like in axis, the xsd:dateTime map to java.util.Calendar.
 I am generating stubs with wsdl2java. A class called DateTimeType is generated by axis based on my wsdl. Here is my schema definition for the DateTimeType. 

xs:complexType name="DateTimeType">
    <xs:simpleContent>
        <xs:extension base="xs:dateTime">
        <xs:attribute fixed="DateTime" name="type" type="xs:string" use="required"/>
        <xs:attribute name="mandatory" type="xs:boolean" use="optional"/>
        <xs:attribute name="readonly" type="xs:boolean" use="optional"/>
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>

It looks like axis generated the following code to deseralize the DateTime. 
        java.util.Calendar cal =
            (java.util.Calendar) new org.apache.axis.encoding.ser.CalendarDeserializer(
                java.lang.String.class, org.apache.axis.Constants.XSD_STRING).makeValue(_value);

Everytime when the server sends the date, it has the format 2007-06-24T00:14:14+00:00 but when the date passes through axis the datetime field value changes to 2007-06-24T00:14:14.000Z with a Z in the tail. My server does not understand this format and reports a SOAP fault. 

Is there any way to change this?

Regards,
Suresh Koya

RE: datetime handling in Axis!

Posted by Mohana Sundaram <pb...@gmail.com>.
Even i am also using the dateTime in my Axis Webservice call, but i am not
getting any error. Instead the the date value is getting changed over a
webservice call.
Example: i am sending 2007-10-25T00:17:30+00:00Z, but in the server i am
getting the value for same field as 2007-06-24T00:18:13+00:00Z. I don't know
why there is one day difference i am getting in server.

Please any help to resolve the above issue.

Thanks,
Mohana Sundaram.



Suresh Koya wrote:
> 
> I tried that but the date arithmetic gets confused with the String
> datatype. I can only change the code on client side. 
> 
> regards,
> Suresh Koya
> 
> "Ford, Jennifer M." <JE...@SOUTHERNCO.COM> wrote:     DateTime is not a
> safe type to use in web  services.  I would recommend using a string or
> long and parsing it back out  to a date object on both sides of the
> interface. 
> 
>   
> ---------------------------------
>  From: Suresh Koya [mailto:surikoya@yahoo.com]  
> Sent: Monday, June 25, 2007 6:23 PM
> To: Axis  User
> Subject: datetime handling in Axis!
> 
> 
>  
> Hi,
> 
>   I am using axis 2.0. I have facing some issues with  the datetime
> handling of axis. It looks like in axis, the xsd:dateTime map to 
> java.util.Calendar.
>  I am generating stubs with wsdl2java. A class  called DateTimeType is
> generated by axis based on my wsdl. Here is my schema  definition for the
> DateTimeType. 
> 
> xs:complexType  name="DateTimeType">
>      <xs:simpleContent>
>          <xs:extension base="xs:dateTime">
>          <xs:attribute fixed="DateTime" name="type" type="xs:string" 
> use="required"/>
>         <xs:attribute  name="mandatory" type="xs:boolean" use="optional"/>
>          <xs:attribute name="readonly" type="xs:boolean"  use="optional"/>
>          </xs:extension>
>      </xs:simpleContent>
> </xs:complexType>
> 
> It looks like  axis generated the following code to deseralize the
> DateTime.  
>         java.util.Calendar cal  =
>              (java.util.Calendar) new 
> org.apache.axis.encoding.ser.CalendarDeserializer(
>                  java.lang.String.class, 
> org.apache.axis.Constants.XSD_STRING).makeValue(_value);
> 
> Everytime when  the server sends the date, it has the format
> 2007-06-24T00:14:14+00:00 but when  the date passes through axis the
> datetime field value changes to  2007-06-24T00:14:14.000Z with a Z in the
> tail. My server does not understand  this format and reports a SOAP fault. 
> 
> Is there any way to change  this?
> 
> Regards,
> Suresh Koya
> 
> 

-- 
View this message in context: http://www.nabble.com/datetime-handling-in-Axis%21-tf3979635.html#a13407444
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: datetime handling in Axis!

Posted by Suresh Koya <su...@yahoo.com>.
I tried that but the date arithmetic gets confused with the String datatype. I can only change the code on client side. 

regards,
Suresh Koya

"Ford, Jennifer M." <JE...@SOUTHERNCO.COM> wrote:     DateTime is not a safe type to use in web  services.  I would recommend using a string or long and parsing it back out  to a date object on both sides of the interface. 

  
---------------------------------
 From: Suresh Koya [mailto:surikoya@yahoo.com]  
Sent: Monday, June 25, 2007 6:23 PM
To: Axis  User
Subject: datetime handling in Axis!


 
Hi,

  I am using axis 2.0. I have facing some issues with  the datetime handling of axis. It looks like in axis, the xsd:dateTime map to  java.util.Calendar.
 I am generating stubs with wsdl2java. A class  called DateTimeType is generated by axis based on my wsdl. Here is my schema  definition for the DateTimeType. 

xs:complexType  name="DateTimeType">
     <xs:simpleContent>
         <xs:extension base="xs:dateTime">
         <xs:attribute fixed="DateTime" name="type" type="xs:string"  use="required"/>
        <xs:attribute  name="mandatory" type="xs:boolean" use="optional"/>
         <xs:attribute name="readonly" type="xs:boolean"  use="optional"/>
         </xs:extension>
     </xs:simpleContent>
</xs:complexType>

It looks like  axis generated the following code to deseralize the DateTime.  
        java.util.Calendar cal  =
             (java.util.Calendar) new  org.apache.axis.encoding.ser.CalendarDeserializer(
                 java.lang.String.class,  org.apache.axis.Constants.XSD_STRING).makeValue(_value);

Everytime when  the server sends the date, it has the format 2007-06-24T00:14:14+00:00 but when  the date passes through axis the datetime field value changes to  2007-06-24T00:14:14.000Z with a Z in the tail. My server does not understand  this format and reports a SOAP fault. 

Is there any way to change  this?

Regards,
Suresh Koya

RE: datetime handling in Axis!

Posted by "Ford, Jennifer M." <JE...@SOUTHERNCO.COM>.
DateTime is not a safe type to use in web services.  I would recommend
using a string or long and parsing it back out to a date object on both
sides of the interface. 

________________________________

From: Suresh Koya [mailto:surikoya@yahoo.com] 
Sent: Monday, June 25, 2007 6:23 PM
To: Axis User
Subject: datetime handling in Axis!


Hi,

  I am using axis 2.0. I have facing some issues with the datetime
handling of axis. It looks like in axis, the xsd:dateTime map to
java.util.Calendar.
 I am generating stubs with wsdl2java. A class called DateTimeType is
generated by axis based on my wsdl. Here is my schema definition for the
DateTimeType. 

xs:complexType name="DateTimeType">
    <xs:simpleContent>
        <xs:extension base="xs:dateTime">
        <xs:attribute fixed="DateTime" name="type" type="xs:string"
use="required"/>
        <xs:attribute name="mandatory" type="xs:boolean"
use="optional"/>
        <xs:attribute name="readonly" type="xs:boolean" use="optional"/>
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>

It looks like axis generated the following code to deseralize the
DateTime. 
        java.util.Calendar cal =
            (java.util.Calendar) new
org.apache.axis.encoding.ser.CalendarDeserializer(
                java.lang.String.class,
org.apache.axis.Constants.XSD_STRING).makeValue(_value);

Everytime when the server sends the date, it has the format
2007-06-24T00:14:14+00:00 but when the date passes through axis the
datetime field value changes to 2007-06-24T00:14:14.000Z with a Z in the
tail. My server does not understand this format and reports a SOAP
fault. 

Is there any way to change this?

Regards,
Suresh Koya