axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Thome <mth...@bbn.com>
Subject Re: xsd:choice (and WSDL2Java)
Date Fri, 25 Feb 2005 15:10:45 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-2022-JP"
 http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Ack - you are correct.&nbsp; I only looked at the generated code (which
looks fine) and tried validating against an example that turned out to
be too simple.<br>
<br>
Now I don't know... Any workaround would be extremely welcome, as I
need this to work, also.<br>
<br>
I really don't want to have to put more tags in, e.g. What ought to
work is something like:<br>
<blockquote>
  <pre wrap=""><tt>&lt;complexType name="FilterList"&gt;
  &lt;sequence&gt;
    &lt;element name="bogus" </tt><tt>minOccurs="1" maxOccurs="unbounded"</tt><tt>&gt;
      &lt;complexType&gt;
       &nbsp;&lt;choice&gt;
          &lt;element name="and" type="query:AndFilter"</tt><tt>/&gt;
          &lt;element name="or" type="query:OrFilter"</tt><tt></tt><tt>/&gt;
          &lt;element name="not" type="query:NotFilter"</tt><tt>/&gt;
        &lt;/choice&gt;
       &lt;/complexType&gt;
    &lt;/element&gt;
  &lt;/sequence&gt;
&lt;/complexType&gt;

</tt></pre>
</blockquote>
but the I'd have to do:<br>
<blockquote>
  <pre wrap=""><tt>&lt;list&gt;
  &lt;bogus&gt;&lt;and/&gt;&lt;/bogus&gt;
  &lt;bogus&gt;&lt;or/&gt;&lt;/bogus&gt;
  &lt;bogus&gt;&lt;and/&gt;&lt;/bogus&gt;
&lt;/list&gt;
</tt></pre>
</blockquote>
<br>
Ugh.<br>
<br>
Bill Keese wrote:
<blockquote cite="mid421E6D65.5040000@tech.beacon-it.co.jp" type="cite">
  <meta content="text/html;charset=ISO-2022-JP"
 http-equiv="Content-Type">
Mik,<br>
  <br>
Thanks for the answer.&nbsp; But I think your work around won't permit data
like this:<br>
  <br>
&nbsp; &lt;list&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp; &lt;and&gt;...&lt;/and&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp; &lt;or&gt;...&lt;/or&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp; &lt;not&gt;...&lt;/not&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp; &lt;and&gt;...&lt;/and&gt;<br>
&nbsp; &lt;/list&gt;<br>
  <br>
Ie, I want to make lists containing different kinds of elements.&nbsp; With
your solution I'm restricted to a list containing one type of
element.&nbsp;&nbsp;&nbsp;&nbsp; (Or to put it another way - I want something
like a java
Collection)<br>
  <br>
Michael Thome wrote:
  <blockquote cite="mid421DF026.3070506@bbn.com" type="cite">
    <meta content="text/html;charset=ISO-2022-JP"
 http-equiv="Content-Type">
    <title></title>
Having just gone through a similar exercise:<br>
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. <br>
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.<br>
3. A search of Jira shows several relevant outstanding bugs: <br>
    <a class="moz-txt-link-freetext"
 href="http://issues.apache.org/jira/browse/AXIS-236">http://issues.apache.org/jira/browse/AXIS-236</a><br>
    <a class="moz-txt-link-freetext"
 href="http://issues.apache.org/jira/browse/AXIS-600">http://issues.apache.org/jira/browse/AXIS-600</a><br>
    <br>
Until fixed, I think the only way to work around the problem is by
putting the min/maxOccurs on the elements, e.g:<br>
    <blockquote>
      <pre wrap=""><tt>&lt;complexType name="FilterList"&gt;
  &lt;sequence&gt;
    &lt;choice&gt;
      &lt;element name="and" type="query:AndFilter"</tt><tt> minOccurs="1"
maxOccurs="unbounded"</tt><tt>/&gt;
      &lt;element name="or" type="query:OrFilter"</tt><tt> minOccurs="1" maxOccurs="unbounded"</tt><tt>/&gt;
      &lt;element name="not" type="query:NotFilter"</tt><tt> minOccurs="1"
maxOccurs="unbounded"</tt><tt>/&gt;
    &lt;/choice&gt;
  &lt;/sequence&gt;
&lt;/complexType&gt;
</tt></pre>
    </blockquote>
cheers,<br>
&nbsp;&nbsp;&nbsp; mik<br>
    <br>
    <br>
Bill Keese wrote:
    <blockquote cite="mid421AF096.2090008@tech.beacon-it.co.jp"
 type="cite">
      <pre wrap="">It looks like WSDL2Java doesn't support xsd:choice for Axis 1.2.
Can
anyone confirm/deny this?

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

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;
...
}
  </pre>
    </blockquote>
  </blockquote>
</blockquote>
</body>
</html>

Mime
View raw message