About XSD Schema Choice Declarations
When a service request element XSD schema contains a complex type with a choice declaration, all potential choice elements are considered optional. When the choice elements are of complex type, apart from populating the fields of the optional element, you must also initialize the optional element itself by using the setter method of the parent bean.
For example:
<element name="Parent">
<complexType>
<choice>
<element ref="tns:Red"/>
<element ref="tns:Blue"/ >
</choice >
</complexType>
</element >
<element name="Red" >
<complexType >
<sequence >
<element name="redField" type="string"/ >
</sequence >
</complexType >
</element >
<element name="Blue" >
<complexType >
<sequence >
<element name="blueField" type="string"/ >
</sequence >
</complexType >
</element >
Red myRed = new Red() ;
myRed.setRedField("test") ;
parent.setRed(myRed);