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 "Greg Sharp (JIRA)" <ji...@apache.org> on 2017/08/01 19:24:00 UTC

[jira] [Updated] (AXIS2-5864) Client wsdl2java is ignoring xs:choice within an xs:all tag

     [ https://issues.apache.org/jira/browse/AXIS2-5864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Greg Sharp updated AXIS2-5864:
------------------------------
    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;
                                       

                               }


  was:
We have the following WSDL 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;
                                       

                               }



> Client wsdl2java is ignoring xs:choice within an xs:all tag
> -----------------------------------------------------------
>
>                 Key: AXIS2-5864
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5864
>             Project: Axis2
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.6.4, 1.7.5
>         Environment: MacOS X, RedHat Enterprise Linux
>            Reporter: Greg Sharp
>
> 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;
>                                        
>                                }



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org