Hi Wolfgang, thanks for your reply.
There is a impl.JAXBContextFactory indeed. But it is not used directly by my
app. I have a JAX-WS Web Service client like this:
public class ServiceClient {
private AuthServicePort port;
public ServiceClient () {
AuthService service = new AuthService();
AuthServicePort port = service.getAuthService();
BindingProvider bp = (BindingProvider) port;
Map<String, Object> map = bp.getRequestContext();
map
.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
Constants.WSDL_LOCATION);
this.port = port;
}
public String authenticate(String login, String password) {
return this.port.authenticate(login, password);
}
*** Other business methods ommited
}
This is it. A simple call to *authenticate *method in a main method results
in the error previously mentioned. Note that in this method I don't even
reference User class (but in others I do).
Any one knows how can I inform JAX-WS runtime the strategy used to JAXB to
generate the stubs? The interfaces are quite important to me, to isolate the
client from changes in the implementation of the service.
Thanks,
Daniel
On Sat, Jul 18, 2009 at 12:26 PM, Wolfgang Laun <wolfgang.laun_at_gmail.com>wrote:
> There should also be a generated class ...impl.JAXBcontextFactory. Is that
> so?
>
> How is the JAXB context created in the client application? With this
> customization, using the class (User.class) as an argument to
> JAXBContext.newInstance(...) will not work; it should be the package name.
>
> -W
>
>
>
> On Fri, Jul 17, 2009 at 11:18 PM, Daniel Melo <dpmelo_at_gmail.com> wrote:
>
>> 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
>>
>>
>