You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Bruce Edge <br...@gmail.com> on 2009/05/11 22:33:12 UTC
wsdl2java & xsd:dateTime to java.util.Date
I've looked at the man pages here:
http://cwiki.apache.org/confluence/display/CXF20DOC/WSDL+to+Java
and they refer to "schema inside the wsd" vs. "schema is out of wsdl".
What exactly does this mean?
I have a wsdl that has both an embedded schema and pulls in data types
from an xsd. What format should I be using in my project-bindings.xml?
Also, what do these vars refer to:
"YOUR_WSDL_LOCATION" Is that
this:"${basedir}/src/main/webapp/WEB-INF/wsdl/DpmCore.wsdl"?
"THE_NAMESPACE_OF_YOUR_SCHEMA" Is this the main namespace, of
that of the schema that refers to the date elements?
"YOUR_SCHEMA_LOCATION" Same as
YOUR_WSDL_LOCATION or different?
This is the text form the above link that I'm trying to decipher:
If you have schema inside the wsdl, here is the binding file you can use:
<jaxws:bindings wsdlLocation="YOUR_WSDL_LOCATION"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<jaxws:bindings
node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='THE_NAMESPACE_OF_YOUR_SCHEMA']">
<jxb:globalBindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jxb:javaType name="java.util.Date" xmlType="xs:dateTime"
parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
</jxb:globalBindings>
</jaxws:bindings>
</jaxws:bindings>
If you want to use java.util.Calendar, just change the
org.apache.cxf.tools.common.DataTypeAdapter to
javax.xml.bind.DatatypeConverter, and change the name value to
"java.util.Calendar" (also, is there a more complete example of this
?)
If your schema is out of wsdl, here is an example you can try:
<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jxb:bindings schemaLocation="YOUR_SCHEMA_LOCATION" node="/xs:schema">
<jxb:globalBindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jxb:javaType name="java.util.Date" xmlType="xs:dateTime"
parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
</jxb:globalBindings>
</jxb:bindings>
</jxb:bindings>
Thanks
-Bruce