You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "DZIEMBOWSKI,KINGA (HP-NewJersey,ex2)" <ki...@hp.com> on 2003/05/21 18:21:29 UTC

ArraySerializer not adding xsi type

The comment for the bug #20071 correctly point that for the wrapped style,
the RPC encoding should not be part of the message. The array need to be
defined in the schema description of the message. In fact the standard xml
definition for array is not enough in this case. The array needs to be
wrapped with external tag in order to be correctly processed by the engine.

Imagine you have a method foo( string[], string ).
If the schema definition for the message will be:

 <xs:element name="foo">
  <xs:complexType mixed="false">
   <xs:sequence>
    <xs:element name="item" nillable="false" type="xs:string" minOccurs="1"
maxOccurs="unbounded" /> 
    <xs:element name="secondparam" nillable="false" type="xs:string" /> 
   </xs:sequence>
  </xs:complexType>
 </xs:element>

will be translated on the wire to:
<foo>
	<item>aaa</item>
	<item>bbb</item>
	<item>ccc</item>
	<item>ddd</item>
	...
	<secondparam>sss</secondparam>
</foo>
And will not be correctly deserialized.

In order to correctly deserialize the message send to invoke such operation,
you need to have the wrapper around the array items. The message need to
look something like:
<foo>
  <ItemList>
	<item>aaa</item>
	<item>bbb</item>
	<item>ccc</item>
	<item>ddd</item>
 </ItemList>
 <secondParam>sss</secondParam>
</foo>

Then the arrays definition for wrapped style should follow the pattern like:

 <xs:element name="foo">
 <xs:complexType>
  <xs:sequence>
  	<xs:element name="ItemList" type="s:ItemListType" /> 
  	<xs:element name="secondparam" type="xs:string" /> 
  </xs:sequence>
 </xs:complexType>
 </xs:element>

 <complexType name="ItemListType">
  <annotation>
    <documentation>
      <s:doc>An element of type ItemListType contains zero or more child
elements of type item. </s:doc> 
    </documentation>
   </annotation>
   <sequence>
      <element name="item" type="string" minOccurs="0" maxOccurs="unbounded"
/> 
   </sequence>
</complexType> 

For wrapped style service, it is very important to make sure that the WSDL
generator generates correct schema representation for arrays.  
Kinga Dziembowski


>One more thing - if you're using wrapped mode, you probably 
> shouldn't be using 
> SOAP encoded arrays at all, but rather "standard" XML 
> collections (i.e. 
> maxOccurs="unbounded" on an element declaration instead of 
> deriving from SOAP-
> ENC:Array).....
>