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


        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        23h 21m 1 Arjen Poutsma 21/May/08 1:14 AM
        In Progress In Progress Resolved Resolved
        43d 23h 7m 1 Arjen Poutsma 04/Jul/08 12:22 AM
        Resolved Resolved Closed Closed
        17d 21h 45m 1 Arjen Poutsma 21/Jul/08 10:07 PM


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


            • Created: