Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5864

Client wsdl2java is ignoring xs:choice within an xs:all tag

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.6.4, 1.7.5
    • Fix Version/s: None
    • Component/s: codegen
    • Labels:
      None
    • Environment:
      MacOS X, RedHat Enterprise Linux

      Description

      We have the following WSDL 1.1 snippet in our WSDL file.

      <xs:element name="credentials">
      <xs:complexType>
      <xs:all>
      <xs:element name="zoneId" type="tns:id" minOccurs="0"/>
      <xs:element name="deviceId" type="tns:id" minOccurs="0"/>
      <xs:element name="deviceProvider" type="xs:string" minOccurs="0"/>
      <xs:element name="deviceCert" type="xs:string" minOccurs="0"/>
      <xs:choice minOccurs="0">
      <xs:element ref="tns:sessionId"/>
      <xs:element ref="tns:login"/>
      <xs:element ref="tns:loginToken"/>
      </xs:choice>
      </xs:all>
      </xs:complexType>
      </xs:element>

      When we generate the client stubs with ApacheAxis2 we don't see the "xs:choice" components showing up in the Java class. Below is what it produces.

      If we change the xs:all to xs:sequence (something we really don't want to do, since the order doesn't matter) then we do get the "xs:choice" components in the class. (The server stubs are correct.)

      Is this a bug or a feature? Is there a workaround besides using xs:sequence?

      The client code produced when using xs:all:
      =================================
      /**

      • Credentials bean class
        */
        @SuppressWarnings( {"unchecked","unused"}

        )

      public class Credentials
      implements org.apache.axis2.databinding.ADBBean{

      public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
      "http://www.XXXX.com/Services/1.1",
      "credentials",
      "ns1");

      /**

      • field for ZoneId
        */

      protected com.xxxx.client.Id localZoneId ;

      /* This tracker boolean wil be used to detect whether the user called the set method

      • for this attribute. It will be used to determine whether to include this field
      • in the serialized XML
        */
        protected boolean localZoneIdTracker = false ;

      public boolean isZoneIdSpecified()

      { return localZoneIdTracker; }

      /**

      • Auto generated getter method
      • @return com.xxxx.client.Id
        */
        public com.xxxx.client.Id getZoneId() { return localZoneId; }

      /**

      • Auto generated setter method
      • @param param ZoneId
        */
        public void setZoneId(com.xxxx.client.Id param) { localZoneIdTracker = param != null; this.localZoneId=param; }

      /**

      • field for DeviceId
        */

      protected com.xxxx.client.Id localDeviceId ;

      /* This tracker boolean wil be used to detect whether the user called the set method

      • for this attribute. It will be used to determine whether to include this field
      • in the serialized XML
        */
        protected boolean localDeviceIdTracker = false ;

      public boolean isDeviceIdSpecified()

      { return localDeviceIdTracker; }

      /**

      • Auto generated getter method
      • @return com.xxxx.client.Id
        */
        public com.xxxx.client.Id getDeviceId() { return localDeviceId; }

      /**

      • Auto generated setter method
      • @param param DeviceId
        */
        public void setDeviceId(com.xxxx.client.Id param) { localDeviceIdTracker = param != null; this.localDeviceId=param; }

      /**

      • field for DeviceProvider
        */

      protected java.lang.String localDeviceProvider ;

      /* This tracker boolean wil be used to detect whether the user called the set method

      • for this attribute. It will be used to determine whether to include this field
      • in the serialized XML
        */
        protected boolean localDeviceProviderTracker = false ;

      public boolean isDeviceProviderSpecified()

      { return localDeviceProviderTracker; }

      /**

      • Auto generated getter method
      • @return java.lang.String
        */
        public java.lang.String getDeviceProvider() { return localDeviceProvider; }

      /**

      • Auto generated setter method
      • @param param DeviceProvider
        */
        public void setDeviceProvider(java.lang.String param) { localDeviceProviderTracker = param != null; this.localDeviceProvider=param; }

      /**

      • field for DeviceCert
        */

      protected java.lang.String localDeviceCert ;

      /* This tracker boolean wil be used to detect whether the user called the set method

      • for this attribute. It will be used to determine whether to include this field
      • in the serialized XML
        */
        protected boolean localDeviceCertTracker = false ;

      public boolean isDeviceCertSpecified()

      { return localDeviceCertTracker; }

      /**

      • Auto generated getter method
      • @return java.lang.String
        */
        public java.lang.String getDeviceCert() { return localDeviceCert; }

      /**

      • Auto generated setter method
      • @param param DeviceCert
        */
        public void setDeviceCert(java.lang.String param) { localDeviceCertTracker = param != null; this.localDeviceCert=param; }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              gjsharp Greg Sharp

              Dates

              • Created:
                Updated:

                Issue deployment