I am attempting to expose a legacy EJB 2.0 service using JBossWS. What I have done is to implement an EJB 3.0 session bean that connects to the EJB 2.0 session bean I want to expose. I defined a method for the service I need and delegated it to the EJB 2.0 bean. The method returns a value object graph that is obviously unannotated since it is living in the Java 1.4.2 world.
Since we don't have the benefit of generics in 1.4.2, JAXB is unable to discern the type of the Collection based fields in my value object graph. Thus, when JAXB attempts to serialize the response, the context is unaware of several of our classes.
It seems that JAXB Introductions will do what I need. I have installed it into my copy of JBoss 4.2.0.GA running JBossWS 2.0.0. I put my jaxb-intros.xml file into the META-INF of my service.ejb3 jar file. Here it is:
<?xml version = "1.0" encoding = "UTF-8"?> <jaxb-intros xmlns="http://www.jboss.org/xsd/jaxb/intros"> <Class name="org.stjude.common.object.SampleFront"> <XmlType name="sampleFront"/> <Field name="refToOrder"> <XmlElement type="org.stjude.common.object.OrderFront"/> </Field> <Field name="sampleInfo"> <XmlElement type="org.stjude.app.lims.common.sample.util.SampleInfo"/> </Field> <Field name="workflow"> <XmlElement type="org.stjude.common.object.Workflow"/> </Field> <Field name="workflows"> <XmlElement type="org.stjude.common.object.Workflow"/> </Field> </Class> <Class name="org.stjude.common.object.Workflow"> <XmlType name="workflow"/> <Field name="workflowDetails"> <XmlElement type="org.stjude.common.object.WorkflowDetail" nillable="true"/> </Field> </Class> </jaxb-intros>
This is not the entire graph, but I figured it would be enough to have some affect and see if this will work. What I've noticed is that the WSDL g
generated for the SampleFront type still shows an untyped Collection for the workflows property:
<xs:complexType name="sampleFront"> <xs:sequence> <xs:element minOccurs="0" name="refToOrder" type="tns:orderFront"/> <xs:element minOccurs="0" name="sampleInfo" type="tns:sampleInfo"/> <xs:element minOccurs="0" name="workflow" type="tns:workflow"/> <xs:element maxOccurs="unbounded" minOccurs="0" name="workflows" nillable="true" type="xs:anyType"/> </xs:sequence> </xs:complexType>
Is this what I should expect to see? I was expecting that the workflows property would be properly typed so that JAXB would continue marshalling down that path. If this doesn't happen then the client code I generated from the WSDL will be incomplete.
Please let me know what the correct behavior should be and also if I have done something incorrect.
Senior Software Engineer
St. Jude Children's Research Hospital