You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Häggkvist,
Lennart <Le...@ppm.nu> on 2007/12/18 18:31:18 UTC
xs:date?
Hi,
I have two questions regarding how to use the xs:date type (not xs:dateTime).
How we can generate an wsdl file with the date type and not the dateTime? Eg.
in my DTO object I have just used:
public Date myDate;
But it translates into the DateTime format in the wsdl - how should I do to generate a date?
If I change(hardcode) the xs:dateTime to xs:date, eg:
<xs:element minOccurs="0" name="myDate" type="xs:date"/>
And also add the following to the .xjb file:
<jxb:javaType name="java.util.Date" xmlType="xs:date"
parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDate"
printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDate"/>
I still get the dateTime format in the return from the server:
<myDate>2002-01-29T00:00:00+01:00</myDate>
Have I done something wrong? Any suggestions? CXF 2.0.2 is used btw.
Thanks,
Lennart
SV: xs:date?
Posted by Häggkvist,
Lennart <Le...@ppm.nu>.
Hi,
I found what the problem was when generating the server classes from the wsdl.
We got two wsdl files and two xjb files. One service uses Date and the the other uses
DateTime. The problem here is that the generated class Adapter1 is overwritten the second
time (only one adapter is created btw) - that means that only the last xjb file is used.
This bug is already reported in CXF-1307 - which also seems to affect 2.0.3...
I can work around this problem by using XMLGregorianCalendar in the one of the two services.
(I tried to use the same XJB file for both services, but it didnt work because? the xjb file
has the location of the wsdl file..)
I still have a problem though - and that is how I can generate an WSDL file from an Java class
with the xs:date and not xs:dateTime directly? Can I use some form of annotation or configuration?
Thanks,
Lennart
-----Ursprungligt meddelande-----
Från: James Mao [mailto:james.mao@iona.com]
Skickat: den 19 december 2007 06:36
Till: cxf-user@incubator.apache.org
Ämne: Re: xs:date?
The server is a JaxWs server, right?
Have you generate the code with the .xjb as a binding file at the server side?
If not, please try it
James
> Hi,
>
> I have two questions regarding how to use the xs:date type (not xs:dateTime).
>
> How we can generate an wsdl file with the date type and not the dateTime? Eg.
> in my DTO object I have just used:
> public Date myDate;
> But it translates into the DateTime format in the wsdl - how should I do to generate a date?
>
> If I change(hardcode) the xs:dateTime to xs:date, eg:
> <xs:element minOccurs="0" name="myDate" type="xs:date"/>
>
> And also add the following to the .xjb file:
> <jxb:javaType name="java.util.Date" xmlType="xs:date"
> parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDate"
>
> printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDate"/>
>
> I still get the dateTime format in the return from the server:
> <myDate>2002-01-29T00:00:00+01:00</myDate>
>
> Have I done something wrong? Any suggestions? CXF 2.0.2 is used btw.
>
> Thanks,
> Lennart
>
>
Re: xs:date?
Posted by James Mao <ja...@iona.com>.
The server is a JaxWs server, right?
Have you generate the code with the .xjb as a binding file at the
server side?
If not, please try it
James
> Hi,
>
> I have two questions regarding how to use the xs:date type (not xs:dateTime).
>
> How we can generate an wsdl file with the date type and not the dateTime? Eg.
> in my DTO object I have just used:
> public Date myDate;
> But it translates into the DateTime format in the wsdl - how should I do to generate a date?
>
> If I change(hardcode) the xs:dateTime to xs:date, eg:
> <xs:element minOccurs="0" name="myDate" type="xs:date"/>
>
> And also add the following to the .xjb file:
> <jxb:javaType name="java.util.Date" xmlType="xs:date"
> parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDate"
> printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDate"/>
>
> I still get the dateTime format in the return from the server:
> <myDate>2002-01-29T00:00:00+01:00</myDate>
>
> Have I done something wrong? Any suggestions? CXF 2.0.2 is used btw.
>
> Thanks,
> Lennart
>
>