Discussion:
Date format issue with cxf-codegen 2.5.0
barthorre
2012-08-14 12:53:26 UTC
Permalink
Hi,

can anyone explain me why I get different results using cxf-codegen-plugin
version 2.4.2-fuse-00-08 and version 2.5.0.fuse-7-061?

With 2.4.2 I get objects of type Calendar where as with 2.5.0 I get objects
of XMLGregorianCalendar. Any reason for this?



My .xjb file is listed below:

<?xml version="1.0" encoding="UTF-8"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xsi:schemaLocation="
http://java.sun.com/xml/ns/jaxb
http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd
http://www.w3.org/2001/XMLSchema
http://www.w3.org/2001/XMLSchema.xsd"
version="2.0">
<bindings>
<globalBindings>
<javaType name="java.util.Calendar" xmlType="xsd:dateTime"

parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"

printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/>

<javaType name="java.util.Calendar" xmlType="xsd:date"

parseMethod="javax.xml.bind.DatatypeConverter.parseDate"

printMethod="javax.xml.bind.DatatypeConverter.printDate"/>
<serializable uid="1" />
</globalBindings>
</bindings>
</bindings>



--
View this message in context: http://cxf.547215.n5.nabble.com/Date-format-issue-with-cxf-codegen-2-5-0-tp5712487.html
Sent from the cxf-user mailing list archive at Nabble.com.
Freeman Fang
2012-08-15 06:08:01 UTC
Permalink
Hi,

I run a quick test with 2.5.0.fuse-7-061, and it can generate Calendar as expected. When it generate XMLGregorianCalendar, it means somehow your binding file isn't picked up, could you double check your binding file path, ensure it could be picked up?

Btw, as 2.5.0.fuse-7-061 is fuse specific version, so you better post your question on fuse forum[1] if it's fuse specific version.
[1]http://fusesource.com/forums/index.jspa?categoryID=1

Freeman

Freeman Fang

FuseSource
Email:ffang-***@public.gmane.org
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042
Post by barthorre
Hi,
can anyone explain me why I get different results using cxf-codegen-plugin
version 2.4.2-fuse-00-08 and version 2.5.0.fuse-7-061?
With 2.4.2 I get objects of type Calendar where as with 2.5.0 I get objects
of XMLGregorianCalendar. Any reason for this?
<?xml version="1.0" encoding="UTF-8"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xsi:schemaLocation="
http://java.sun.com/xml/ns/jaxb
http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd
http://www.w3.org/2001/XMLSchema
http://www.w3.org/2001/XMLSchema.xsd"
version="2.0">
<bindings>
<globalBindings>
<javaType name="java.util.Calendar" xmlType="xsd:dateTime"
parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/>
<javaType name="java.util.Calendar" xmlType="xsd:date"
parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
printMethod="javax.xml.bind.DatatypeConverter.printDate"/>
<serializable uid="1" />
</globalBindings>
</bindings>
</bindings>
--
View this message in context: http://cxf.547215.n5.nabble.com/Date-format-issue-with-cxf-codegen-2-5-0-tp5712487.html
Sent from the cxf-user mailing list archive at Nabble.com.
barthorre
2012-08-15 07:13:12 UTC
Permalink
Hi Freeman,

thanks for the reply. I'll post this in the fuse forum aswell.

Now, the only thing I changed was the version number in my pom file. Didn't
even touch any configs.
And this config worked as expected with 2.4.2.

Do you perhaps require any additional logging to get a better view of what's
going on here?



--
View this message in context: http://cxf.547215.n5.nabble.com/Date-format-issue-with-cxf-codegen-2-5-0-tp5712487p5712603.html
Sent from the cxf-user mailing list archive at Nabble.com.
Freeman Fang
2012-08-15 07:45:46 UTC
Permalink
Hi,

When I tested it, I actually use your binding file.
We have a wsdl_first example in CXF kit, which use binding file to customize the xsd:date from wsdl/schema, which is exactly same as your scenario.
You can edit $CXF_HOME/samples/wsdl_first/src/main/resources/binding.xml, change the content same as your binding file.
Then run "mvn clean install"
then in $CXF_HOME/samples/wsdl_first/target/generated-sources/cxf/com/example/customerservice/Customer.java

you can find it generate the import java.util.Calendar; for setBirthDate as expected.
public void setBirthDate(Calendar value) {
this.birthDate = value;
}


Freeman


Freeman Fang

FuseSource
Email:ffang-***@public.gmane.org
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042
Post by barthorre
Hi Freeman,
thanks for the reply. I'll post this in the fuse forum aswell.
Now, the only thing I changed was the version number in my pom file. Didn't
even touch any configs.
And this config worked as expected with 2.4.2.
Do you perhaps require any additional logging to get a better view of what's
going on here?
--
View this message in context: http://cxf.547215.n5.nabble.com/Date-format-issue-with-cxf-codegen-2-5-0-tp5712487p5712603.html
Sent from the cxf-user mailing list archive at Nabble.com.
barthorre
2012-08-16 10:06:30 UTC
Permalink
The example you referred to helped me fix the problem, I think

in my previous pom file i had :

<wsdlOption>
<wsdl>

${basedir}/../cdtbl-service-wsdl/src/main/resources/wsdl/geefCodetabelDienst.wsdl
</wsdl>
<extraargs>
<extraarg>-verbose</extraarg>
<extraarg>

-xjc-b,${basedir}/../cdtbl-service-wsdl/src/main/resources/wsdl/Datum.xjb
</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>

Now, I am no CXF expert, I'm just upgrading an environment to fuse esb 7,
but I take this kind of configuration isn't allowed anymore when using
codege 2.5.x?

When I changed to
<wsdlOption>

<wsdl>src/main/resources/wsdl/geefCodetabelDienst.wsdl</wsdl>
<bindingFiles>

<bindingFile>src/main/resources/wsdl/Datum.xjb</bindingFile>
</bindingFiles>
</wsdlOption>

the type of
public void setBeginDatum(Calendar value) {
this.beginDatum = value;
}

was succesfully compiled to java.util.Calender

Thanks guys!



--
View this message in context: http://cxf.547215.n5.nabble.com/Date-format-issue-with-cxf-codegen-2-5-0-tp5712487p5712688.html
Sent from the cxf-user mailing list archive at Nabble.com.

Glen Mazza
2012-08-15 13:33:36 UTC
Permalink
FWIW, the "wsdl_first" sample in the CXF distribution uses a binding.xml
file:
http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/wsdl_first/src/main/resources/binding.xml?revision=1306003&view=markup,
perhaps its setup is something you can use.

Glen
Post by Freeman Fang
Hi,
I run a quick test with 2.5.0.fuse-7-061, and it can generate Calendar as expected. When it generate XMLGregorianCalendar, it means somehow your binding file isn't picked up, could you double check your binding file path, ensure it could be picked up?
Btw, as 2.5.0.fuse-7-061 is fuse specific version, so you better post your question on fuse forum[1] if it's fuse specific version.
[1]http://fusesource.com/forums/index.jspa?categoryID=1
Freeman

Freeman Fang
FuseSource
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042
Post by barthorre
Hi,
can anyone explain me why I get different results using cxf-codegen-plugin
version 2.4.2-fuse-00-08 and version 2.5.0.fuse-7-061?
With 2.4.2 I get objects of type Calendar where as with 2.5.0 I get objects
of XMLGregorianCalendar. Any reason for this?
<?xml version="1.0" encoding="UTF-8"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xsi:schemaLocation="
http://java.sun.com/xml/ns/jaxb
http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd
http://www.w3.org/2001/XMLSchema
http://www.w3.org/2001/XMLSchema.xsd"
version="2.0">
<bindings>
<globalBindings>
<javaType name="java.util.Calendar" xmlType="xsd:dateTime"
parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/>
<javaType name="java.util.Calendar" xmlType="xsd:date"
parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
printMethod="javax.xml.bind.DatatypeConverter.printDate"/>
<serializable uid="1" />
</globalBindings>
</bindings>
</bindings>
--
View this message in context: http://cxf.547215.n5.nabble.com/Date-format-issue-with-cxf-codegen-2-5-0-tp5712487.html
Sent from the cxf-user mailing list archive at Nabble.com.
Loading...