Hi Dan,

XmlAdapter only solves the technical problem of having classes that do not work well with jaxb. I think the even more important problem in this case is that the implementation details are made visible to the service. This means that later changes to the implementation will alsways affect the service clients. So for java first I would most times choose a facade rather than using the XmlAdapter. The only case where I would omit the facade is when client and server are in the same release unit (what means they will always be updated at the same time).

Greetings

Christian


Daniel Kulp schrieb:
Well, with a little work, you could keep doing java first. Basically, you would need to write an XmlAdapter<Date, Calendar> (see JAXB) or similar that would convert your date objects to a form that JAXB can use (usually a calendar). Basically, if doing java first with anything complex, learning the XmlAdapter things is a good idea. Most complex things can be worked around with them.
Dan


On Sun September 27 2009 5:20:22 pm Christian Schneider wrote:
Hi Eugene,

I guess you are using the Java first method of writing your service.
Generally this can be problematic if you use special classes like
org.joda.time.DateTime.
It seems JAXB can not automatically generate a service from this class
that works.

If you want to stay with Java first then you should create a facade for
the service that only uses classes that work for services. For example
Date or Calendar for your date property.

Generally it is much better to use WSDL First like in the WSDl first
example. If you have trouble directly writing the WSDL you can use the
method I described in:
http://cxf.apache.org/docs/defining-contract-first-webservices-with-wsdl-ge
neration-from-java.html

Greetings

Christian

Eugène Stassen schrieb:
Hello,

I have to call methods localized on a distant server. I can choose the
API for the communication. I followed a tutorial on the CXF site (
http://cxf.apache.org/docs/a-simple-jax-ws-service.html
http://cxf.apache.org/docs/a-simple-jax-ws-service.html ) and it works
very well. Unfortunately, one of my object has a member variable like
this :

class MyObject
{
    org.joda.time.DateTime date;
}

When I look for the xml messages, the date field is transformed to this :
"<date />". I can't find the way to do the change xml <-> java myself. Is
there an easy way to do this (for example with annotations) ?

I precise that I don't use Spring or other things like that, juste what
it is said in the tutorial. And I am a noob in java entreprise
applications.

Thanks !

Eugène Stassen



--

Christian Schneider
---
http://www.liquid-reality.de

Reply via email to