Hi Navneet,

Good question, but "the recommended way" presumes some authority we all accept, no? :-) I have several reasons for the technique I chose.

1. It is gross for a schema to have up-dependencies into the SOAP layer.

2. The code I wrote is cleaner and simpler, and therefore the first thing that came to mind.

3. WS-I basic profile, normative statements R2110, R2111, R2112. See http://www.ws-i.org/Profiles/Basic/2003-06/BasicProfile-1.0-BdAD.html#refinement34108752.


Is Axis attempting to track the WS-I recommendations?


Stu

Navneet Joneja wrote:
Any reason you defined your schema like this rather than using the array
spec (the recommended way to do it), like so:

<xs:complexType name="Out1Type">
<xs:sequence>
<xs:element name="Out1Item1" type="xs:string"/>
<xs:element name="Out1Item2" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOfOut1Type">
<xs:restriction base="soapenc:Array">
<xs:attribute ref="soapenc:ArrayType"
wsdl:arrayType="mywsdl:Out1Type[]"/>
</xs:restriction>
</xs:complexType>


From the WSDL spec:

Array types should extend the Array type defined in the SOAP v1.1 encoding
schema (http://schemas.xmlsoap.org/soap/encoding/) (regardless of whether
the resulting form actually uses the encoding specified in Section 5 of the
SOAP v1.1 document). Use the name ArrayOfXXX for array types (where XXX is
the type of the items in the array). The type of the items in the array and
the array dimensions are specified by using a default value for the
soapenc:arrayType attribute. At the time of this writing, the XSD
specification does not have a mechanism for specifying the default value of
an attribute which contains a QName value. To overcome this limitation,
WSDL introduces the arrayType attribute (from namespace
http://schemas.xmlsoap.org/wsdl/) which has the semantic of providing the
default value. If XSD is revised to support this functionality, the revised
mechanism SHOULD be used in favor of the arrayType attribute defined by
WSDL.



-----Original Message----- From: Stu Halloway (DevelopMentor) [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 5:24 PM To: axis-user Subject: Axis 1.1 generates incorrect code for maxOccurs="unbounded"?


Hi all,


I am building an Axis Web service to be consumed by a .NET client, and so far neither side's code generation or marshalling is behaving as I would expect.

Given this element:

   <xs:element name="Out1">
     <xs:complexType>
       <xs:sequence minOccurs="0" maxOccurs="unbounded">
         <xs:element name="Out1Item1" type="xs:string"/>
         <xs:element name="Out1Item2" type="xs:int"/>
       </xs:sequence>
     </xs:complexType>
   </xs:element>

Axis is generating a class that allows only single values for Out1Item1 and Out1Item2, i.e.

     public class _Out1  implements java.io.Serializable {
     private java.lang.String out1Item1;
     private int out1Item2;

     public java.lang.String getOut1Item1() {
         return out1Item1;
     }

     public void setOut1Item1(java.lang.String out1Item1) {
         this.out1Item1 = out1Item1;
     }
     //etc.

Is this expected?

You can download the full example at
http://staff.develop.com/halloway/ReturnArrays.html. If this is a known bug I would be interested in helping to fix it.


Regards,
Stu
http://staff.develop.com/halloway/weblog




Reply via email to