[jboss-user] [JBossWS] - Re: Problem with inheritance and JBossWS

hannes.koller do-not-reply at jboss.com
Thu Jun 21 06:05:15 EDT 2007


I tried to post this in  JIRA but it told me I dont have permission to comment on the issue so here it goes: 

I am experiencing the same problem described by original Reporter: Subclass information gets lost when the SOAP message is created....but not always.. if the class  contains a variable of JAXBElement  then the inheritance seems to work correctly for all attributes in the class.

Example (constructed to explain my point, sorry if not 100% correct but the WSDL I am really dealing with is quite huge). 

  | <complexType name="SomeType">
  |   <complexContent>
  |       <sequence>
  |         <element name="someElement" type="tns:SomeElement" minOccurs="0" maxOccurs="1"nillable="true"/>
  |       <element name="classB" type="tns:ClassB" minOccurs="1" maxOccurs="1" nillable="true" />
  |     </sequence>
  |   </complexContent>
  | </complexType>
  | 
Note that the minOccurrs="0" together with nillable="true" in someElement will cause wsconsume to create the JAXBElement<..> variable i was talking about: 


  | public class SomeType{
  | 
  |     @XmlElementRef(name = "someElement", namespace = "http://some.namespace.com", type = JAXBElement.class)
  |     protected JAXBElement<SomeElement> someElement;
  |     @XmlElement(required = true, nillable = true)
  |     protected ClassB classB; 
  | ....
  | 

In this example  inheritance for the classB Attribute works as expected. Whereas if I alter the wsdl and set the minOccurrs of someElement to 1  thus having wsconsume create the following class: 


  | public class SomeType{
  | 
  |     @XmlElement(required=true, nillable=true)
  |     protected SomeElement someElement;
  |     @XmlElement(required = true, nillable = true)
  |     protected ClassB classB; 
  | ...
  | 
  | 
then inheritance on classB breaks. 


Not sure why this is happening, but I thought this observation might help to track down the cause of this.




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056371#4056371

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056371



More information about the jboss-user mailing list