Ack - you are correct.  I only looked at the generated code (which looks fine) and tried validating against an example that turned out to be too simple.

Now I don't know... Any workaround would be extremely welcome, as I need this to work, also.

I really don't want to have to put more tags in, e.g. What ought to work is something like:
<complexType name="FilterList">
  <sequence>
    <element name="bogus" minOccurs="1" maxOccurs="unbounded">
      <complexType>
        <choice>
          <element name="and" type="query:AndFilter"/>
          <element name="or" type="query:OrFilter"/>
          <element name="not" type="query:NotFilter"/>
        </choice>
       </complexType>
    </element>
  </sequence>
</complexType>

but the I'd have to do:
<list>
  <bogus><and/></bogus>
  <bogus><or/></bogus>
  <bogus><and/></bogus>
</list>

Ugh.

Bill Keese wrote:
Mik,

Thanks for the answer.  But I think your work around won't permit data like this:

  <list>
     <and>...</and>
     <or>...</or>
     <not>...</not>
     <and>...</and>
  </list>

Ie, I want to make lists containing different kinds of elements.  With your solution I'm restricted to a list containing one type of element.     (Or to put it another way - I want something like a java Collection)

Michael Thome wrote:
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