Hello,

well, according to my sources, it'll return java.util.GregorianCalendar 
(but internally during it's creation also XMLGregorianCalendar is used)

didn't you mixed something?
after i used CalendarAdapter (instead of setting parse/print methods), 
alll strange classes like foo.bar.SetOrderCalendarDates_WrapperTypeHelper1 
has disappeared from my project.

best regards
jano






"Cord Awtry" <[EMAIL PROTECTED]> 
05/20/2008 14:01
Bitte antworten an
[email protected]


An
[email protected]
Kopie

Thema
Re: dateTime custom binding [Virus checked]






Jano,

  That did the trick, thanks. I'm curious if you or anyone else has any
insight on a follow-up question. It would seem the XMLGregorianCalendar is
still in use, at least partially, after using the custom bindings file to
convert them all to java.util.Calendar objects. Below is a
ClassCastException with an XMLGregorianCalendar as well as code snippets
from the source.

  Thanks again,

    -C-

***EXCEPTION***
Caused by: java.lang.ClassCastException:
com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl
        at
foo.bar.SetOrderCalendarDates_WrapperTypeHelper1.createWrapperObject(Unknown
Source)
        at
org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:102)
        ... 49 more

***JAVA OBJECT FOR WS CALL***
/**
 * <p>Java class for anonymous complex type.
 *
 * <p>The following schema fragment specifies the expected content 
contained
within this class.
 *
 * <pre>
 * &lt;complexType>
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType";>
 *       &lt;sequence>
 *         &lt;element name="requiredDates"
type="{http://bar.foo}ArrayOfDateTime";
minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "requiredDates",
})
@XmlRootElement(name = "SetOrderCalendarDates")
public class SetOrderCalendarDates {
    protected ArrayOfDateTime requiredDates;
.
.
.
}

***CHILD OBJECT***
/**
 * <p>Java class for ArrayOfDateTime complex type.
 *
 * <p>The following schema fragment specifies the expected content 
contained
within this class.
 *
 * <pre>
 * &lt;complexType name="ArrayOfDateTime">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType";>
 *       &lt;sequence>
 *         &lt;element name="dateTime" type="{
http://www.w3.org/2001/XMLSchema}dateTime"; maxOccurs="unbounded"
minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfDateTime", propOrder = {
    "dateTime"
})
public class ArrayOfDateTime {

    @XmlElement(type = String.class)
    @XmlJavaTypeAdapter(CalendarXMLAdapter.class)
    @XmlSchemaType(name = "dateTime")
    protected List<Calendar> dateTime;

    public List<Calendar> getDateTime() {
        if (dateTime == null) {
            dateTime = new ArrayList<Calendar>();
        }
        return this.dateTime;
    }

}

On Mon, May 19, 2008 at 2:56 PM, <[EMAIL PROTECTED]>
wrote:

> Hello,
>
> see below.
>
> best regards
> jano
>
> <?xml version="1.0" encoding="UTF-8"?>
> <bindings version="2.1"
>        xmlns="http://java.sun.com/xml/ns/jaxb";
>        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>        xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc";
>        >
>
>        <globalBindings>
>                <xjc:javaType name="java.util.Calendar" 
xmlType="xsd:date"
>                        adapter="xxx.common.jaxb.CalendarAdapter" />
>
>                <xjc:javaType name="java.util.Calendar" 
xmlType="xsd:time"
>                        adapter="xxx.common.jaxb.CalendarAdapter" />
>
>                <xjc:javaType name="java.util.Calendar"
> xmlType="xsd:dateTime"
>                        adapter="xxx.common.jaxb.CalendarAdapter" />
>        </globalBindings>
> </bindings>
>
>
> package xxx.common.jaxb;
>
> import java.util.Calendar;
>
> import javax.xml.bind.annotation.adapters.XmlAdapter;
>
> public class CalendarAdapter extends XmlAdapter<String, Calendar> {
>
>        public Calendar unmarshal(String value) {
>        return (javax.xml.bind.DatatypeConverter.parseDateTime(value));
>    }
>
>    public String marshal(Calendar value) {
>        if (value == null) {
>            return null;
>        }
>        return (javax.xml.bind.DatatypeConverter.printDateTime(value));
>    }
>
> }
>
>
>
>
>
> "Cord Awtry" <[EMAIL PROTECTED]>
> 05/19/2008 20:49
> Bitte antworten an
> [email protected]
>
>
> An
> [email protected]
> Kopie
>
> Thema
> dateTime custom binding  [Virus checked]
>
>
>
>
>
>
> Hello all,
>
>  Wondering if someone can lend some advice on an issue I'm seeing (may
> not
> even be an issue, I'm open to that as an answer ;) ). Essentially, I 
have
> a
> WSDL being generated by CXF with all my types inline. I have a bunch of
> xs:datetime objects which are being converted to XMLGregorianCalendar 
when
> I
> run wsdlToJava. I've done a bunch of research on this, seen several
> solutions and have yet to see anything work. I've copied the code from 
the
> cwiki for solving this, but still no resolution. It's possible what I 
view
> as the proper resolution may be incorrect. Essentially, I'd like to get
> rid
> of all the instances of XMLGregorianCalendar in my generated java files
> and
> have them be java.util.Date objects. Below is a copy of my bindings that
> I'm
> using with CXF 2.1. If anyone has any thoughts as to why I'm still 
getting
> XMLGregorianCalendar objects in my generated java files, I'd be more 
than
> happy to hear it.
>
>  Thanks,
>
>    -C-
>
> <jaxws:bindings wsdlLocation="
> http://127.0.0.1:8080/ext/services/Extension?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:[EMAIL PROTECTED]'
> http://www.tmu.com/services/Extension/2008/05'<
http://www.tmu.com/services/Extension/2008/05%27>
> ]">
>    <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>
>
>

Reply via email to