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

Axis2 Jaxb binding and MTOM issue

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.3, 1.4
    • None
    • databinding

    Description

      I tried a simple web service client with JAXB binding, and noticed that MTOM parts are being in-lined in the soap message as opposed to being XOP attachments.
      The same client works fine with ADB binding.

      Code example:
      FileDataSource fileDataSource = new FileDataSource("C:
      upload.dat");
      DataHandler fileDataHandler = new DataHandler(fileDataSource);
      InitiateRequest request = new InitiateRequest();
      request.setRequestId("xxxxx");
      request.setSubmission(fileDataHandler);
      request.setSignature(sigDataHandler);

      Response:
      --MIMEBoundaryurn_uuid_EAE9BC656EBBB536921205317613109
      Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
      Content-Transfer-Encoding: binary
      Content-ID: <0.urn:uuid:EAE9BC656EBBB536921205317613110@apache.org>
      <?xml version='1.0' encoding='UTF-8'?>
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Body>
      <InitiateRequest xmlns="urn:uploadfile">
      <requestId>xxxxx</requestId>
      <submission>VGVzdCBQYWluIFN1Ym1pc3Npb24=</submission>
      <signature>VGVzdCBzaWduYXR1cmU=</signatur>
      </InitiateRequest>
      </soapenv:Body>
      </soapenv:Envelope>-MIMEBoundaryurn_uuid_EAE9BC656EBBB536921205317613109-0

      There are different views on this:
      <Ajith Ranabahu>
      Perhaps this has to do with JAXB using the StAX interfaces to
      read/write XML ? If you see the MTOM support in ADB you'll see we went
      to great lengths to provide a way to carry over the binary blob to the
      data binding framework without text conversions. We did this by
      introducing a property value through the StAX readers getProperties
      method (See [1] for details)

      So unless the data binding framework would know about this behavior
      then it is unlikely that they support optimal binary. AFAIK we have a
      similar problem with XMLBeans

      Ajith

      [1] http://wso2.org/library/236

      <dims>
      Narayan,

      with jaxb you can supply your own data handlers for streaming. hopefully
      someone on the team can help write a sample.
      Please add an enhancement request for a sample in JIRA so we won't
      forget.

      thanks,
      dims

      Attachments

        Activity

          People

            Unassigned Unassigned
            narayan0205 Narayan Singh Dhillon
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: