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
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