users@jaxb.java.net

Problem with JAXB and Interfaces

From: Daniel Melo <dpmelo_at_gmail.com>
Date: Fri, 17 Jul 2009 18:18:11 -0300

Hi all,

I'm having a problem with JAXB and JAX-WS Runtime. Suppose the following
schema piece:

<xs:complexType name="*ctUser*">
        <xs:sequence>
            <xs:element name="login" minOccurs="1" maxOccurs="1"
                type="xsd:string" />
        </xs:sequence>
</xs:complexType>

And the following JAXB customization file:

<jaxb:globalBindings *generateValueClass="false"*/>

<jaxb:bindings node="//xsd:complexType[@name='*ctUser*']">
    <jaxb:class name="User"/>
</jaxb:bindings>

When I run *wsimport*, two files are generated: *User *(an interface),
and *UserImpl
*(a concrete implementation of User). That's exactly what I expected.

The problem is, when I try to invoke my Web Service with a client using the
generated classes, the following error occurs:

*javax.ejb.EJBException: java.lang.IllegalStateException: Cannot build JAXB
context*

*com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of
IllegalAnnotationExceptions
foo.bar.User is an interface, and JAXB can't handle interfaces.*

Any helps will be highly appreciated.

thanks,

Daniel