You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2002/11/01 02:41:48 UTC

DO NOT REPLY [Bug 14152] New: - Java2WSDL generates invalid WSDL for arrays specified as public members

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14152>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14152

Java2WSDL generates invalid WSDL for arrays specified as public members

           Summary: Java2WSDL generates invalid WSDL for arrays specified as
                    public members
           Product: Axis
           Version: 1.0
          Platform: Other
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: WSDL processing
        AssignedTo: axis-dev@xml.apache.org
        ReportedBy: martin.j@jabmail.com


If a class contains an array defined using a public member, eg:

public class MyClass {
  public String[] Values;
}

the generated WSDL looks like this:

<complexType name="MyClass">
 <sequence>
  <element maxOccurs="unbounded" name="Values" nillable="true" 
type="xsd:string"/>
 </sequence>
</complexType>

This is not a valid representation of an array, as an array must be given its 
own accessor which derives from the SOAP-ENC:Array type.

If the array is defined using bean setter/getter methods as follows:

public class MyClass {
	private String[] Values;
	public String[] getValues() {
		return Values;
	}
	public void setValues(String[] values) {
		Values=values;
	}
}

The generated WSDL looks like this:

   <complexType name="MyClass">
    <sequence>
     <element name="values" nillable="true" type="impl:ArrayOf_xsd_string"/>
    </sequence>
   </complexType>
   <complexType name="ArrayOf_xsd_string">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
     </restriction>
    </complexContent>
   </complexType>

This is the correct representation of an array.

The WSDL generated by public members and bean methods should be the same (and 
correct!)

The workaround is to always use getter/setter methods for array properties, but 
this results in the accessor names always having a lower-case first character, 
which will break existing applications.