JAX-WS data handler
The Enterprise JavaBeans (EJB) import binding uses the JAX-WS data handler to turn request business objects into Java™ object parameters and to turn the Java object return value into the response business object. The EJB export binding uses the JAX-WS data handler to turn request EJBs into request business objects and to turn the response business object into a return value.
The JAX-WS data handler is used by default when the EJB binding has a WSDL interface. This data handler cannot be used to transform a SOAP message representing a JAX-WS invocation to a data object.
- The EJB binding sets the expected type, expected element, and targeted method name in the BindingContext to match those specified in the WSDL.
- The EJB binding invokes the transform method for the data object requiring data transformation.
- The data handler returns an Object[] representing the parameters of the method (in the order of their definition within the method).
- The EJB binding uses the Object[] to invoke the method on the target EJB interface.
- The first element in the Object[] is the return value from the Java method invocation.
- The subsequent values represent the input parameters for the method.
This is required to support the In/Out and Out types of parameters.
For parameters of type Out, the values must be returned in the response data object.
The data handler processes and transforms values found in the Object[] and then returns a response to the data object.
@XmlAnyElement (lax=true) for the JavaBeans property in the Java code, as shown in the following example: public class TestType {
private Object[] object;
@XmlAnyElement (lax=true)
public Object[] getObject() {
return object;
)
public void setObject (Object[] object) {
this.object=object;
)
)This makes the property object in TestType an xs:any
field. The Java class value
used in the xs:any field should have the @XmlAnyElement annotation.
For example, if Address is the Java class
being used to populate the object array, the Address class should
have the annotation @XmlRootElement.- The data handler does not include support for the header attribute
@WebParamannotation. - The namespace for business object schema files (XSD files) does
not include default mapping from the Java package
name. The annotation
@XMLSchemain package-info.java also does not work. The only way to create an XSD with a namespace is to use the@XmlTypeand@XmlRootElementannotations.@XmlRootElementdefines the target namespace for the global element in JavaBeans types. - The EJB import wizard does not create XSD files for unrelated
classes. Version 2.0 does not support the
@XmlSeeAlsoannotation, so if the child class is not referenced directly from the parent class, an XSD is not created. The solution to this problem is to run SchemaGen for such child classes.SchemaGen is a command line utility (located in the WPS_Install_Home/bin directory) provided to create XSD files for a given bean. These XSDs must be manually copied to the module for the solution to work.