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

Parsing of response ends up in a IllegalStateException (attribute type accessed in illegal event!)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.6
    • 1.7.7
    • codegen, wsdl
    • None
    • Windows 10, Java 1.8.0_131

    Description

      Hello there,

      we are using AXIS2 to generate and use ServiceStubs to handle SOAP webservices.
      We upgraded AXIS2 from 1.6.4 to 1.7.6.
      After that we generated a new ServiceStub via WSDL2Java based on the following command:

      wsdl2java -uri xtc_wsdl.xml -s -d adb -u -S ./
      

      (xtc_wsdl.xml is attached)

      If we now get the following response from the webservice, the parsing runs into a IllegalStateException.

      getOrdersByStatus_response.xml:

      <?xml version="1.0" encoding="utf-8"?>
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="webservice/xtc/plugins/Speed4Trade/com">
      	<SOAP-ENV:Body>
      		<ns1:getOrdersByStatusResponse>
      			<orders/>
      		</ns1:getOrdersByStatusResponse>
      	</SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
      

      Error:
      java.lang.IllegalStateException: attribute type accessed in illegal event!
      at org.apache.axiom.om.impl.common.serializer.pull.Navigator.getAttributeValue(Navigator.java:507)
      at org.apache.axiom.om.impl.common.serializer.pull.PullSerializer.getAttributeValue(PullSerializer.java:261)
      at javax.xml.stream.util.StreamReaderDelegate.getAttributeValue(StreamReaderDelegate.java:149)
      at com.speed4trade.plugins.xtc.webservice.Order$Factory.parse(Order.java:671)
      at com.speed4trade.plugins.xtc.webservice.Orders$Factory.parse(Orders.java:428)
      at com.speed4trade.plugins.xtc.webservice.GetOrdersByStatusResponse$Factory.parse(GetOrdersByStatusResponse.java:389)
      at com.speed4trade.plugins.xtc.webservice.XtcServiceStub.fromOM(XtcServiceStub.java:5906)
      ... 7 more

      I have debugged the Stub and compared it to the old one of version 1.6.4.
      I noticed here a code change caused by a change in the XSL template https://github.com/apache/axis2-java/commit/26d78d25e60183c14d901139ad3cdce432e393d0:

      ADBBeanTemplate-bean.xsl, line 2190

      This generates now this statement in the Orders.java:

                      if ((reader.isStartElement() &&
                              new javax.xml.namespace.QName("", "orders").equals(
                                  reader.getName())) ||
                              new javax.xml.namespace.QName("", "orders").equals(
                                  reader.getName())) {...}
      

      Is it possible that this if-statement is not correct?

      Thanks for considering my request.

      Attachments

        1. getOrdersByStatus_response.xml
          0.3 kB
          Carl-Ferdinand Böhm
        2. Orders.java
          19 kB
          Carl-Ferdinand Böhm
        3. xtc_wsdl.xml
          96 kB
          Carl-Ferdinand Böhm

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cfboehm Carl-Ferdinand Böhm
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: