|
|
||
Doug Kohlert's BlogOctober 2006 ArchivesJAX-WS and JMSPosted by kohlert on October 17, 2006 at 03:27 PM | Permalink | Comments (0)A JMS transport project for JAX-WS 2.1 has been added as a subproject of JAX-WS. This project contains a JMS plugin that can be used with JAX-WS 2.1. The project is open source and includes a runnable sample. Check it out! If you are interested in developing a transport plugin for JAX-WS, please send an email to owner@jax-ws.dev.java.net. JAX-WS is part of the Glassfish community. JAX-WS and type substitutionPosted by kohlert on October 02, 2006 at 09:45 AM | Permalink | Comments (4)Currently, JAX-WS does not support type substitution in cases where Java types are used at runtime that are not directly or indirectly referenced by the SEI. The reason for this is because you must specify all of the types that will be used at runtime at the time the JAXBContext is created. Since JAX-WS can only introspect the SEI there is no way to determine what other classes the developer may use at runtime. Take the following SEI for example.
@WebService
public interface MyEndpoint {
public Shape echo(Shape);
}
abtract class Shape {}
but the following classes are also used by the application:
class Square extends Shape; class Circle extends Shape;In the current JAX-WS implementation only the Shape class can be used.
We have the same problem when starting from WSDL and schema; only the schema types referenced by the wsdl:Port will be visible to the JAX-WS runtime.
In short, we need to solve two related problems:
@XmlSeeAlso annotation.
package javax.xml.bind.annotations;
@Target({ElementType.TYPE})
public @interface XmlSeeAlso {
Class[] value();
}
This annotation will be allowed on any JAXB-bound type, and when JAXB binds that type, classes listed in @XmlSeeAlso will be also bound. So this can be used like this:
@XmlSeeAlso({Bar.class,Zot.class})
abstract class Foo {}
class Bar extends Foo {}
class Zot extends Foo {}
and "JAXBContext.newInstance(Foo.class)" will include all three classes. (Without @XmlSeeAlso annotation on Foo, JAXBContext.newInstance(Foo.class) will include only Foo.)
JAX-WS 2.1 will allow developers to place this annotation on a SEI.
JAX-WS will then read this annotation at runtime making sure to pass all
of the classes referenced by this annotation to the JAXBContext.
When importing a WSDL that contains types that are not directly referenced by the endpoint definition, JAX-WS 2.1 will generate @XmlSeeAlso annotation on the SEI. This @XmlSeeAlso annotation will
reference all of the ObjectFactories generated by JAXB. For example
@WebService
@XmlSeeAlso({package1.ObjectFactory.class, package2.ObjectFactory.class})
public interface MyEndpoint {
...
}
Technorati: JSR JCP JAX JAXWS Web Services Glassfish | ||
|
|