I have a bug unmarshalling an array of objects in a jaxrpc webservice. 
Here is the incoming soap message. I am passing a collection of ProductA 
objects where ProductA is a subclass of Product.

<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
  |  <env:Header/>
  |  <env:Body>
  |   <ns1:purchase 
xmlns:ns1='http://org.jboss.ws/samples/docstyle/wrapped/types' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
  |    <String_1>Karen</String_1>
  |    <arrayOfProduct_2 xsi:type='ns1:ProductA'>
  |     <name>cyfac</name>
  |     <price>3000</price>
  |    </arrayOfProduct_2>
  |    <arrayOfProduct_2 xsi:type='ns1:ProductA'>
  |     <name>look</name>
  |     <price>5000</price>
  |    </arrayOfProduct_2>
  |    <arrayOfProduct_2 xsi:type='ns1:ProductA'>
  |     <name>GOSPORT</name>
  |     <price>1000</price>
  |    </arrayOfProduct_2>
  |   </ns1:purchase>
  |  </env:Body>
  | </env:Envelope>

The relevant part of the schema looks like this:
   <complexType name='purchase'>
  |     <sequence>
  |      <element name='String_1' nillable='true' type='string'/>
  |      <element maxOccurs='unbounded' minOccurs='0' name='arrayOfProduct_2' 
nillable='true' type='tns:Product'/>
  |     </sequence>
  |    </complexType>
  | 
  |    <complexType name='Product'>
  |     <sequence>
  |      <element name='name' nillable='true' type='string'/>
  |     </sequence>
  |    </complexType>
  |    
  |    <complexType name='ProductA'>
  |     <complexContent>
  |      <extension base='tns:Product'>
  |       <sequence>
  |        <element name='price' type='int'/>
  |       </sequence>
  |      </extension>
  |     </complexContent>
  |    </complexType>
  |    
  |    <complexType name='purchaseA'>
  |     <sequence>
  |      <element name='String_1' nillable='true' type='string'/>
  |      <element maxOccurs='unbounded' minOccurs='0' name='arrayOfProductA_2' 
nillable='true' type='tns:ProductA'/>
  |     </sequence>
  |    </complexType>

The behavior in the service is that only the last element of the Product 
sequence is received in the purchase method.

If I use the purchaseA method which expects a collection of ProductA as 
argument, the result is correct.

The bug seems related to JBXB-96 which is marked as fixed. My purchase() method 
works with the 1.0.0.GA version of jboss-xml-binding (which was included with 
jboss 4.2.1.GA, jbossws-1.2.1.GA), but fails in 1.0.0.SP1 (aka CR11) which has 
the fix for JBXB-96. So it fails with all the jbossws-2.0.x versions.

I also looked at the test case created for this bug 
(org.jboss.test.xml.XsiTypeUnitTestCase). It works, but in that case, the 
collection of objects is the only content of the message. I modified the test 
case to add a wrapper object with a member appearing before the collection. 
That testcase fails in the same way as my webservice; only the last element of 
the collection appears in the parent object.

Karen Lease

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4109647
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to