package level XmlJavaTypeAdapter annotation

R

rolf.watermann

Hi all,

I have to write a JAX-WS WebService which uses interface types as
parameters and return values. Everything works fine if I annotate my
interface with a type adapter:

package com.acme.jaxws.server;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@XmlJavaTypeAdapter(SimpleAdapter.class)
public interface Simple {
String getDummy();
}

However, if I use a package level annotation in package-info.java
instead,

@XmlJavaTypeAdapter(value=SimpleAdapter.class,type=Simple.class)
package com.coremedia.examples.jaxws.server;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

I get a runtime exception "com.acme.jaxws.server.Simple is an
interface, and JAXB can't handle interfaces."

package-info.java is correctly compiled and deployed.
The portable artifacts generated with apt are identical, even without
an annotation at all.
I tried Apache cxf with Java 6 as well as Metro with Java 1.5, the
exception is the same. So it looks like a JAXB runtime issue.

Why does JAXB not consider my package level XmlJavaTypeAdapter
annotation?

My actual usecase is to pass objects of a library interface. So I
have no access to the source code, and thus annotating the interface
itself is no option.

Thanks,
Rolf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top