Deserialized array is of size 1!!
xtremebytes Jul 21, 2005 6:24 AMI am using JBoss 4.0.2 on JRE 1.5, Eclipse 3.0.2 with JBoss IDE 1.4.1-e31-jre15. I have a session bean, which has two methods exposed to a service endpoint interface. I have written my jaxrpc-mapping.xml, webservices.xml and ws4ee-deployment.xml (to map custom data types to appropriate deserializers). One of these methods is supposed to return an array of custom beans. I wrapped the array as a bean, which is something like:
public class MyArrayWrapper { private MyDataType[] underlyingArray; private String anotherField; //public no argument constructor //public getter/setters }
I have additional methods inside the array (not getter/setters) which can be used by the session bean to resize the array dynamically and set the data at a particular index in the array, but I don't think that matters to the serializer. I use
org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactoryand
org.jboss.webservice.encoding.ser.MetaDataBeanDeSerializerFactoryto handle this array as well as the the MyDataType, which is a simple Java bean.
I use Java2WSDL to generate the WSDL, which looks like the following in its type mapping for the array.
<schema targetNamespace="http://myservice.session.mycompany.com" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> <complexType name="ArrayOf_tns3_MyDataType"> <complexContent> <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayType="tns3:MyDataType[]"/> </restriction> </complexContent> </complexType> </schema> <schema targetNamespace="http://myservice.session.mycompany.com" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> <complexType name="MyArrayWrapper"> <sequence> <element name="underlyingArray" nillable="true" type="impl:ArrayOf_tns3_MyDataType"/> <element name="anotherField" type="xsd:string"/> </sequence> </complexType> </schema>
Using rpc/LITERAL, the service deploys fine apart from a jaxrpc-warning about type mapping, which I do not understand because the package it complains about exists and is mapped in jaxrpc-mapping.xml. Anyway, that's a warning.
I use an Axis client (JRE 1.5 generated by JBoss IDE) to invoke the WS call. The call succeeds without any error on the server. I have Axis servlet logging turned on. The response SOAP message looks perfect with all the necessary data. The response array contains 28 elements (say) but the client only gets one element after deserializing the SOAP message. What's going wrong? Why is the array getting trimmed to one element?