Having just gone through a similar exercise:
1. I think the correct approach ought to be to attach the min/max attributes to the choice rather than to the sequence - e.g. you want a single sequence of any number of a choice of {and,or,not} elements, not any number of sequences of a single choice.
2. but: although both can be used perfectly fine with the expected documents and validation, wsdl2java appears to silently ignore min/max attributes on non-element declarations.
3. A search of Jira shows several relevant outstanding bugs:
http://issues.apache.org/jira/browse/AXIS-236
http://issues.apache.org/jira/browse/AXIS-600

Until fixed, I think the only way to work around the problem is by putting the min/maxOccurs on the elements, e.g:
<complexType name="FilterList">
  <sequence>
    <choice>
      <element name="and" type="query:AndFilter" minOccurs="1" maxOccurs="unbounded"/>
      <element name="or" type="query:OrFilter" minOccurs="1" maxOccurs="unbounded"/>
      <element name="not" type="query:NotFilter" minOccurs="1" maxOccurs="unbounded"/>
    </choice>
  </sequence>
</complexType>
cheers,
    mik


Bill Keese wrote:
It looks like WSDL2Java doesn't support xsd:choice for Axis 1.2. Can
anyone confirm/deny this?

I had a declaration like this:
<complexType name="FilterList">
<sequence minOccurs="1" maxOccurs="unbounded">
<choice>
<element name="and" type="query:AndFilter"/>
<element name="or" type="query:OrFilter"/>
<element name="not" type="query:NotFilter"/>
</choice>
</sequence>
</complexType>

I expected the generated java code to look like this:
class FilterList {
Filters[] filters;
}

But instead it's a strange class like below. The problem w/the class
below is that you can't have a FilterList containing two or more "and"
nodes.

public class FilterList implements java.io.Serializable {
private jp.co.beacon_it.inicio.client.soap.schema.query.AndFilter and;
private jp.co.beacon_it.inicio.client.soap.schema.query.OrFilter or;
private jp.co.beacon_it.inicio.client.soap.schema.query.NotFilter not;
...
}
  

Reply via email to