Greetings!

I am evaluating CXF as a replacement for Axis and have run into a bit of a 
problem.

My requirement is to ensure that the wsdl generated by CXF matches the wsdl 
produced by our old services. The main problem I am facing is with customising 
the return types/parameters of a method with regards to dates.

We are using the JodaTime library internally but want to send a "dateTime" 
element over the wire. Typical methods exposed on an SEI might look something 
like these:

Public LocalDate getDayCheeseExpires() {...}

Public void getCheeseByDate(LocalDate date) ()...

The WSDL representation of LocalDate on the wire needs to be a xsd:dateTime. 
From reading the literature available and searching the mailing lists it 
appears that I cannot simply register an XmlAdapter for LocalDate (I have tried 
and it doesn't appear to work).

I have also tried wrapping the return type in a DateTO which is annotated with:

@XmlType(name="dateTime", namespace = "http://www.w3.org/2001/XMLSchema";)
@XmlJavaTypeAdapter(DateTOAdapter.class)

I was under the impression that JAXB would invoke my adapter when it 
encountered a DateTO. The methods in DateTOAdapter don't appear to be invoked 
when I invoke the web service. In fact JAXB complains on context initialisation 
that:

"Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts 
of IllegalAnnotationExceptions
org.joda.time.DateTimeFieldType does not have a no-arg default constructor.
        this problem is related to the following location:
                at org.joda.time.DateTimeFieldType
                at org.joda.time.DateTimeFieldType[]"

My DateTO looks like:

@XmlJavaTypeAdapter(DateTOAdapter.class)
@XmlType(name="dateTime", namespace = "http://www.w3.org/2001/XMLSchema";)
public class DateTO {

    private LocalDate date;

    public DateTO() {
        date = null;
    }

    public DateTO(LocalDate o) {
        this.date = o;
    }

    public LocalDate getDate() {
        return date;
    }
}

I am a complete n00b to both CXF and JAXB having been playing with Xfire + 
Aegis bindings until now. Is it possible to do what I want with CXF/JAXB and 
the JAXB front end?

Best regards,

James lewis

***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 
 
This e-mail message is confidential and for use by the 
addressee only. If the message is received by anyone other 
than the addressee, please return the message to the sender 
by replying to it and then delete the message from your 
computer. Internet e-mails are not necessarily secure. The 
Royal Bank of Scotland plc does not accept responsibility for 
changes made to this message after it was sent. 

Whilst all reasonable care has been taken to avoid the 
transmission of viruses, it is the responsibility of the recipient to 
ensure that the onward transmission, opening or use of this 
message and any attachments will not adversely affect its 
systems or data. No responsibility is accepted by The 
Royal Bank of Scotland plc in this regard and the recipient should carry 
out such virus and other checks as it considers appropriate. 
Visit our websites at: 
www.rbs.com
www.rbs.com/gbm
www.rbsgc.com
***********************************************************************************

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

Reply via email to