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

        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.
        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.
        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.
        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
        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
        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
        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

          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