• Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.2
    • Fix Version/s: 1.5.3
    • Component/s: Core
    • Labels:
    • Environment:
      WinXP, Java 1.5, Axiom 1.2.7, HttpClient 3.1


      Incoming SOAP messages with attachments are parsed correctly, but outgoing messages with attachments are missing attachment parts and all part boundaries, even though the overall HTTP content-type is "multipart/related" with a boundary value specified.

      Given this message sending scenario:

      WebServiceMessageCallback requestCallback = new WebServiceMessageCallback() {
        public void doWithMessage(WebServiceMessage message)
            throws IOException, TransformerException {
          SoapMessage soapMessage = (SoapMessage) message;
              generateContentId(), // generates a unique Content-ID String
              new ByteArrayResource(attachmentData),   // Data
              "application/octet-stream");        // Content-Type
      // ...create response extractor ....
        requestCallback, responseExtractor);

      I get an HTTP message like this:

      Accept-Encoding: gzip
      Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_3D927F4433B32F68641210953465313; type="text/xml"; start="0.urn:uuid:[email protected]"; charset="UTF-8"
      SOAPAction: "SendSubmissionReceipts"
      User-Agent: Jakarta Commons-HttpClient/3.1
      Cookie: $Version=0; JSESSIONID=0001JGVZICF0ATPGIDRKW5J1LHY:11p9fo6l7; $Path=/
      Content-Length: 3978
      <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=""><soapenv:Header>[contents intentionally omitted]</soapenv:Header><soapenv:Body>[contents intentionally omitted]</soapenv:Body></soapenv:Envelope>

      Correct overall content-type and boundary value, but no attachment parts and no boundaries.

      The problem may be in CommonsHttpConnection.onSendAfterWrite() where a ByteArrayRequestEntity is always used instead of the MultipartRequestEntity that the Commons HttpClient API says should be used for requests with attachments

      protected void onSendAfterWrite(WebServiceMessage message) throws IOException {
        postMethod.setRequestEntity(new ByteArrayRequestEntity(requestBuffer.toByteArray()));
        requestBuffer = null;

      It would seem to me that onSendAfterWrite() should be checking the WebServiceMessage to see if there are any attachments, and if there are, creating the necessary xml message and attachment Parts and passing them to a MultipartRequestEntity instead of sending the entire request to a ByteArrayRequestEntity.


        barsimp47 Barry Simpson created issue -
        arjen.poutsma Arjen Poutsma made changes -
        Field Original Value New Value
        Fix Version/s 1.5.3 [ 10982 ]
        arjen.poutsma Arjen Poutsma made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        arjen.poutsma Arjen Poutsma made changes -
        Summary outgoing SOAP messages with attachments created incorrectly Axiom does not support SwA attachments
        arjen.poutsma Arjen Poutsma made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        arjen.poutsma Arjen Poutsma made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


          • Assignee:
            arjen.poutsma Arjen Poutsma
            barsimp47 Barry Simpson
          • Votes:
            1 Vote for this issue
            1 Start watching this issue


            • Created: