Axiom
  1. Axiom
  2. AXIOM-119

Attachment order is not preserved in Axiom

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.9
    • Component/s: None
    • Labels:
      None

      Description

      Scenario;

      Axiom reads an inbound message message containing attachments.
      Axiom writes the message so that it can be sent to another service.
      The remote service fails because the attachments are sent in the wrong order.

      Problem:
      The order of the attachments is not preserved. In most cases, this is not an issue because the receiving service will use mtom, swaref or other references to obtain the attachment information. However some older style SWA implementations or legacy vendors do rely on the attachment order.

      Solution:
      I am working on a small change and accompanying test to allow Axiom to preserve the attachment order.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        21h 50m 1 Rich Scheuerle 17/Jun/09 12:06
        Resolved Resolved Reopened Reopened
        3d 8h 35m 1 Andreas Veithen 20/Jun/09 20:42
        Reopened Reopened Resolved Resolved
        16h 25m 1 Davanum Srinivas 21/Jun/09 13:07
        Resolved Resolved Closed Closed
        643d 23h 35m 1 Andreas Veithen 27/Mar/11 12:43
        Hide
        Hudson added a comment -

        Integrated in ws-axiom-trunk #463 (See https://builds.apache.org/job/ws-axiom-trunk/463/)
        AXIOM-119: Always preserve the order of attachments (which was already the default behavior since r785554). There is no use case where the pre-r785554 behavior (i.e. sorting attachments by content ID) would be mandatory [1], and removing support for this frees us from the constraint of maintaining two collections with different orders in the Attachments class.

        [1] XOP explicitly specifies that the order of MIME parts is irrelevant. The same should be true for SwA messages using swaRef. Finally, for services described using the WSDL MIME binding, preserving the order of attachments is mandatory.

        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
        Show
        Hudson added a comment - Integrated in ws-axiom-trunk #463 (See https://builds.apache.org/job/ws-axiom-trunk/463/ ) AXIOM-119 : Always preserve the order of attachments (which was already the default behavior since r785554). There is no use case where the pre-r785554 behavior (i.e. sorting attachments by content ID) would be mandatory [1] , and removing support for this frees us from the constraint of maintaining two collections with different orders in the Attachments class. [1] XOP explicitly specifies that the order of MIME parts is irrelevant. The same should be true for SwA messages using swaRef. Finally, for services described using the WSDL MIME binding, preserving the order of attachments is mandatory. veithen : Files : /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java /webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
        Andreas Veithen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Jeff Turner made changes -
        Fix Version/s Axiom 1.2.9 [ 12315532 ]
        Andreas Veithen made changes -
        Project WS-Commons [ 12310250 ] Axiom [ 12311190 ]
        Key WSCOMMONS-477 AXIOM-119
        Component/s AXIOM [ 12310703 ]
        Fix Version/s Axiom 1.2.9 [ 12313561 ]
        Hide
        Davanum Srinivas added a comment -

        Andreas,

        I'd let Rich answer that specifically. My guess is that he wants to preserve existing behavior as-is till we hit say Axiom 1.3. we may be being a bit more paranoid than required

        – dims

        Show
        Davanum Srinivas added a comment - Andreas, I'd let Rich answer that specifically. My guess is that he wants to preserve existing behavior as-is till we hit say Axiom 1.3. we may be being a bit more paranoid than required – dims
        Hide
        Andreas Veithen added a comment -

        Dims,

        Could you also answer the question I asked above about why this should actually be configurable and not be the default behavior?

        Thanks,

        Andreas

        Show
        Andreas Veithen added a comment - Dims, Could you also answer the question I asked above about why this should actually be configurable and not be the default behavior? Thanks, Andreas
        Davanum Srinivas made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Davanum Srinivas added a comment -

        please see r787001 for details.

        http://svn.apache.org/viewvc?view=rev&revision=787001

        thanks,
        dims

        Show
        Davanum Srinivas added a comment - please see r787001 for details. http://svn.apache.org/viewvc?view=rev&revision=787001 thanks, dims
        Andreas Veithen made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Andreas Veithen added a comment -

        The change in r785554 causes a regression in Axis2. The failing test case is org.apache.axis2.swa.EchoRawSwATest in module "integration". There is a server side failure with the following stack trace:

        java.lang.NullPointerException
        at org.apache.axiom.om.impl.MIMEOutputUtils.createMimeBodyPart(MIMEOutputUtils.java:157)
        at org.apache.axiom.om.impl.MIMEOutputUtils.writeDataHandlerWithAttachmentsMessage(MIMEOutputUtils.java:326)
        at org.apache.axiom.om.impl.MIMEOutputUtils.writeSOAPWithAttachmentsMessage(MIMEOutputUtils.java:275)
        at org.apache.axis2.transport.http.SOAPMessageFormatter.writeSwAMessage(SOAPMessageFormatter.java:204)
        at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:355)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:232)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:440)
        at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
        at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:178)
        at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173)
        at org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:267)
        at org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:281)
        at org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:187)
        at org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:82)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:613)

        I will temporarily revert the change.

        Show
        Andreas Veithen added a comment - The change in r785554 causes a regression in Axis2. The failing test case is org.apache.axis2.swa.EchoRawSwATest in module "integration". There is a server side failure with the following stack trace: java.lang.NullPointerException at org.apache.axiom.om.impl.MIMEOutputUtils.createMimeBodyPart(MIMEOutputUtils.java:157) at org.apache.axiom.om.impl.MIMEOutputUtils.writeDataHandlerWithAttachmentsMessage(MIMEOutputUtils.java:326) at org.apache.axiom.om.impl.MIMEOutputUtils.writeSOAPWithAttachmentsMessage(MIMEOutputUtils.java:275) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeSwAMessage(SOAPMessageFormatter.java:204) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:355) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:232) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:440) at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:178) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173) at org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:267) at org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:281) at org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:187) at org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:82) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:613) I will temporarily revert the change.
        Andreas Veithen made changes -
        Fix Version/s Axiom 1.2.9 [ 12313561 ]
        Hide
        Andreas Veithen added a comment -

        Rich,

        What is the reason to make this configurable? Why wouldn't we always write the attachments in the order they have been added (or read)? I don't see any situation where writing the attachments in random order (determined by the internals of HashMap or HashSet) would make sense.

        Show
        Andreas Veithen added a comment - Rich, What is the reason to make this configurable? Why wouldn't we always write the attachments in the order they have been added (or read)? I don't see any situation where writing the attachments in random order (determined by the internals of HashMap or HashSet) would make sense.
        Rich Scheuerle made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Rich Scheuerle added a comment -

        Committed revision 785554

        Kudos to Tim Mitchell (IBM) for finding this issue and providing verification.

        Show
        Rich Scheuerle added a comment - Committed revision 785554 Kudos to Tim Mitchell (IBM) for finding this issue and providing verification.
        Rich Scheuerle created issue -

          People

          • Assignee:
            Rich Scheuerle
            Reporter:
            Rich Scheuerle
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 48h
              48h
              Remaining:
              Remaining Estimate - 48h
              48h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development