axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kroll, Stephanie" <>
Subject RE: .NET and Apache Axis interop issue with xsd:date and xsd:dateTime
Date Wed, 04 Jun 2003 16:49:10 GMT
What you need to do is to add Axis type metadata to the bean being serialized that contains
the Date property.  Type metadata is added to the generated classes when you run WSDL2Java.
 The metadata is read by Axis at runtime and used in the serialization process.  This feature
is almost totally undocumented in the Axis documentation.

If you run WSDL2Java on the AddressBook sample, you'll see that you get an Address class generated
with some static methods and a static initializer that declare the XML types for the bean's

In your case, if you add the static type description methods to your bean and set the XmlType
of the Date property to an xsd:date, like below, then Axis will only return the date portion
and drop the time.
elemField.setXmlType(new QName("", "date"));


-----Original Message-----
From: Armstrong, Jason []
Sent: Wednesday, June 04, 2003 9:12 AM
To: ''
Subject: .NET and Apache Axis interop issue with xsd:date and


I have an Apache Axis web service using document/literal encoding that
returns an object hierarchy (using the bean serializer/deserializer), one of
the attributes on this field is declared as an xsd:date (I also tried
xsd:dateTime).  The web service client is an .NET application.  The problem
I am having is that too much information is being sent back to the client
when the java.util.Date or java.util.Calendar object is being serialized.
In this particular case the value '2003-08-15T18:35:22.981Z' is being
returned.  In this particular web service I need to only send the date
portion back e.g. '2003-08-15'  Any recommendations?

Additionally, I do have requirements for other web services to be able to
include dates and times together, so I also need to be able to include a
date/time string that .NET can successfully parse.  Right now, I'm cheating
and sending the values back as xsd:string, but I'd like to be able to use a
more accurate type declaration.  I've thought about writing a custom
serializer/deserializer for xsd:date and xsd:dateTime, but I don't have any
great desire to reinvent the wheel if it's already been done.  Any advice
and recommendations would be appreciated.

Thanks in advance for any and all help!

Jason S. Armstrong
Applications Manager | Management Science Associates, Inc.

View raw message