I upgraded to CXF 2.7.0 and verified that the binding file is being used. The adapter classes are generated correctly; however, they see to only go into effect when an @XmlJavaTypeAdapter annotation is included in the class. The normal codegen-plugin does not apply that annotation when the type is an Object[][]. How do I tell my CXF client that the Object array MAY contain
dates that should be converted to Calendars?  Thanks.

Barry

On 12/4/2012 11:11 PM, Freeman Fang wrote:
Hi,

Yep, most likely your binding file not get picked up.
Please take a look at a related discussion[1].
If you use cxf-codegen-plugin to specify the binding file, you should use 
sthing like
                                  <wsdlOption>
                                     
<wsdl>src/main/resources/wsdl/your.wsdl</wsdl>
                                     <bindingFiles>
                                         
<bindingFile>src/main/resources/wsdl/your.xjb</bindingFile>
                                     </bindingFiles>
                                 </wsdlOption>

[1]http://cxf.547215.n5.nabble.com/Date-format-issue-with-cxf-codegen-2-5-0-td5712487.html

-------------
Freeman(Yue) Fang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-12-5, at 上午5:40, Barry Hathaway wrote:

I'd like to have CXF unmarshal dates to java.util.Calendar, but I'm not sure 
how to do it.
The dates may be contained in Object[][] array as in:

public class QueryResultSetServer {

    private Object[] columnNames;
    private Object[][] resultSet;

...getters and setters
}

I've specified a binding.xml file of:

<jaxws:bindings wsdlLocation="SadlService.wsdl"
          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='http://sadlserver.sadl.research.ge.com']">
      <jxb:globalBindings>
        <jxb:javaType name="java.util.Calendar" xmlType="xs:dateTime"
parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/>
        <jxb:javaType name="java.util.Calendar" xmlType="xs:date"
parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
printMethod="javax.xml.bind.DatatypeConverter.printDate"/>
      </jxb:globalBindings>
  </jaxws:bindings>
</jaxws:bindings>

however, when I generate the classes the adapters do not seem to be used.
As a result when the dates get unmarshalled they are of the class:
org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl

Any suggestions?
Thanks in advance.

Barry Hathaway




Reply via email to