Subclass elements in web service response returned with type="fully qualified 
class name" instead of xsi:type="ns:SchemaType"
-----------------------------------------------------------------------------------------------------------------------------

                 Key: AXIS2-4092
                 URL: https://issues.apache.org/jira/browse/AXIS2-4092
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: adb
    Affects Versions: 1.3
            Reporter: Balaji Hari
            Priority: Critical


Axis2 service returns type="com.bmc.bcan.dto.SubjectLinesDTO" instead of 
xsi:type="ns1:SubjectLinesDTO" in soap response.

This causes issues when the response has elements of sub-types.

Snippet from WSDL definition:

- <xs:complexType name="RuleDTO">
- <xs:sequence>
  <xs:element minOccurs="0" name="annotation" nillable="true" type="xs:string" 
/> 
  <xs:element maxOccurs="unbounded" minOccurs="0" name="applicableTrails" 
nillable="true" type="xs:int" /> 
  <xs:element minOccurs="0" name="deviceTypeId" nillable="true" type="xs:int" 
/> 
...
  <xs:element minOccurs="0" name="subject" nillable="true" 
type="ax21:SubjectDTO" /> 
</xs:sequence>
 </xs:complexType>

Definition of SubjectDTO (which has following sub types).

<xs:complexType name="SubjectDTO">
- <xs:sequence>
  <xs:element minOccurs="0" name="caseSensitive" type="xs:boolean" /> 
  <xs:element minOccurs="0" name="frequency" nillable="true" type="xs:int" /> 
  <xs:element minOccurs="0" name="ignoreWhitespace" type="xs:boolean" /> 
  <xs:element minOccurs="0" name="key" nillable="true" type="ax21:KeyDTO" /> 
  <xs:element minOccurs="0" name="COMPONENT_CLASSNAME" nillable="true" 
type="xs:string" /> 
  </xs:sequence>
  </xs:complexType>


- <xs:complexType name="SubjectCollectionDTO">
- <xs:complexContent>
- <xs:extension base="ax21:SubjectDTO">
- <xs:sequence>
  <xs:element maxOccurs="unbounded" minOccurs="0" name="collection" 
nillable="true" type="xs:string" /> 
  <xs:element minOccurs="0" name="contiguous" type="xs:boolean" /> 
  <xs:element minOccurs="0" name="ordered" type="xs:boolean" /> 
  </xs:sequence>
  </xs:extension>
  </xs:complexContent>
  </xs:complexType>

- <xs:complexType name="SubjectLinesDTO">
- <xs:complexContent>
- <xs:extension base="ax21:SubjectCollectionDTO">
  <xs:sequence /> 
  </xs:extension>
  </xs:complexContent>
  </xs:complexType>

Server Response :

<return type="com.bmc.bcan.dto.RuleDTO">
                <ns1:annotation></ns1:annotation>
                <ns1:applicableTrails
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:nil="true" />
                <ns1:deviceTypeId>0</ns1:deviceTypeId>
               <!-- SubType Element -->
                   <ns1:subject type="com.bmc.bcan.dto.SubjectLinesDTO">
                    <ns1:collection>set mls flow full</ns1:collection>
                    <ns1:collection>
                        set mls nde ${global.netflowDestination}
                        ${global.netflowPort}
                    </ns1:collection>
                    <ns1:collection>
                        set mls nde version 5
                    </ns1:collection>
                    <ns1:collection>set mls nde enable</ns1:collection>
                    <ns1:collection>
                        set mls agingtime long 64
                    </ns1:collection>
                    <ns1:collection>
                        set mls agingtime fast 16 0
                    </ns1:collection>
                    <ns1:contiguous>false</ns1:contiguous>
                    <ns1:ordered>false</ns1:ordered>
                    <ns1:caseSensitive>false</ns1:caseSensitive>
                    <ns1:frequency>2</ns1:frequency>
                    <ns1:ignoreWhitespace>true</ns1:ignoreWhitespace>
                    <ns1:key type="com.bmc.bcan.dto.KeyDTO">
                        <ns1:keyString>458169663-121</ns1:keyString>
                    </ns1:key>
                </ns1:subject>
                <ns1:substitutionValidation>
                    true
                </ns1:substitutionValidation>
                <ns1:trigger
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                    xsi:nil="true" />
                <ns1:violationSeverity>5</ns1:violationSeverity>
            </return>

The base type in RuleDTO has been defined as SubjectDTO. Since the type 
attribute is not xsi:type
in the client SubjectDTO.Factory.parse() is called which can't find the 
elements of sub-type


Exception in thread "main" org.apache.axis2.AxisFault: 
org.apache.axis2.databinding.ADBException: Unexpected subelement collection
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at 
com.bmc.bcan.ws.service.RuleServiceStub.fromOM(RuleServiceStub.java:30216)
        at 
com.bmc.bcan.ws.service.RuleServiceStub.getRules(RuleServiceStub.java:498)
        at com.bmc.bcan.ws.test.RuleServiceTest.main(RuleServiceTest.java:39)
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: 
Unexpected subelement collection
        at 
com.bmc.bcan.ws.service.RuleServiceStub$SubjectDTO$Factory.parse(RuleServiceStub.java:20920)
        at 
com.bmc.bcan.ws.service.RuleServiceStub$RuleDTO$Factory.parse(RuleServiceStub.java:7711)
        at 
com.bmc.bcan.ws.service.RuleServiceStub$GetRulesResponse$Factory.parse(RuleServiceStub.java:8372)
        at 
com.bmc.bcan.ws.service.RuleServiceStub.fromOM(RuleServiceStub.java:30196)
        ... 2 more
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement 
collection
        at 
com.bmc.bcan.ws.service.RuleServiceStub$SubjectDTO$Factory.parse(RuleServiceStub.java:20914)
        ... 5 more

Is this a know issue. Any fix or axis services.xml parameter on the server side 
will be helpful.

-Balaji



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to