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

ADB parse issue when maxOccurs > 0, element contains an anyType sub-element, and one is nil.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.5.4, 1.5.6
    • None
    • adb, codegen
    • None
    • Windows

    Description

      ADB fails to parse subsequent elements in a list when one is encountered containing anyType element with nil value.

      Here is my schema example:

      <xs:element name="GenericParameter" type="dtns:GenericParameter" />
      <xs:complexType name="GenericParameter">
      <xs:sequence>
      <xs:element name="name" type="xs:string" />
      <xs:element name="value" nillable="true" type="xs:anyType" />
      </xs:sequence>
      </xs:complexType>

      Here is how it's referenced:

      <xs:element name="getSubscriptionProfile" type="tns:getSubscriptionProfile" />
      <xs:complexType name="getSubscriptionProfile">
      <xs:sequence>
      <xs:element name="subscriptionRef" type="xs:string" />
      <xs:element name="parameters" nillable="true" minOccurs="0" maxOccurs="unbounded" type="dtns:GenericParameter" />
      </xs:sequence>
      </xs:complexType>

      Here is an offending message:

      <getSubscriptionProfile>
      <subscriptionRef>12345</subscriptionRef>
      <parameters>
      <name>A</name>
      <value xsi:type="xsd:long">-1</value>
      </parameters>
      <parameters>
      <name>B</name>
      <value xsi:type="xsd:long">-1</value>
      </parameters>
      <parameters>
      <name>C</name>
      <value xsi:type="xsd:string" xsi:nil="true" />
      </parameters>
      <parameters>
      <name>D</name>
      <value xsi:type="xsd:string">Hello</value>
      </parameters>
      <parameters>
      <name>E</name>
      <value xsi:type="xsd:decimal">10</value>
      </parameters>
      <parameters>
      <name>F</name>
      <value xsi:type="xsd:decimal">20</value>
      </parameters>
      </getSubscriptionProfile>

      Here is a code snippet I ran to verify:

      out.println("START");
      reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(request));
      reqObject = GetSubscriptionProfile.Factory.parse(reader);
      for (Object param : reqObject.getParameters())

      { out.println(param.getName() + " = " + param.getValue()); }

      out.println("END");

      And here is the output from that script:

      START
      A = -1
      B = -1
      C = null
      END

      Note that "E = 10" and "F = 20" are missing from the output. The parsed parameter list is missing all elements after the null one.

      I verified the issue against both 1.5.4 and 1.5.6. Did not try with 1.6.

      Attachments

        Activity

          People

            Unassigned Unassigned
            agourley Aaron Gourley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: