We use CXF framework with aegis mapper for java server and .NET client. By default we have minOccurs=0 for all variables in classes in WSDL. We use such setting in CXF config to prevent it:
<bean id="aegisBean" class="org.apache.cxf.aegis.databinding.AegisDatabinding" scope="prototype">
<property name="configuration">
<bean class="org.apache.cxf.aegis.type.TypeCreationOptions">
<property name="defaultNillable" value="false"/>
<property name="defaultMinOccurs" value="1"/>
</bean>
</property>
</bean>
But we have another problem with a开发者_如何转开发rray. For array we have such code in WSDL:
<xsd:complexType name="ArrayOfDetails">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="Details" type="tns:Details"/>
</xsd:sequence>
</xsd:complexType>
So empty arrays are not accepted:
org.apache.cxf.interceptor.Fault: The number of elements in {http://dto.WebServices.com}ArrayOfDetails does not meet the mini mum of 1
Is it possible, to add annotation to array, which set minOccurs="0" to elements of the array (not to the whole array)? Or is it possible to set it is aegis configuration for all arrays?
<xsd:element minOccurs="0" maxOccurs="unbounded" name="Details" type="tns:Details"/>
You should use a mapping file:
<mappings>
<mapping name="ArrayOfDetails">
<property name="Details" minOccurs='0'/>
</mapping>
</mappings>
精彩评论