Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6430

SwA: Wrong Content-Type of root part

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.1
    • 3.1.1, 3.0.6, 2.7.17
    • Transports
    • None
    • Unknown

    Description

      we are implementing an ebMS3 solution using cxf 3. The profile to be implemented has the following requirements:

      • SwA (no MTOM)
      • SOAP 1.2
      • Due to the design of ebMS3 there is no WSDL

      As there is no WSDL we use the javax.xml.ws.Dispatch API with SOAPBinding.SOAP12HTTP_BINDING as binding. The message ebMS3 expects, according to its specification looks as follows:

      Content-Type: Multipart/Related; boundary=MIME_boundary;
      type=application/soap+xml;
      start="<car-data@cars.example.com>"

      --MIME_boundary

      Content-Type: application/soap+xml; charset=UTF-8
      Content-Transfer-Encoding: 8bit
      Content-ID: <car-data@cars.example.com>

      <?xml version='1.0' ?>
      <S12:Envelope xmlns:S12="http://www.w3.org/2003/05/soap-envelope"
      .
      .
      .
      </S12:Envelope>

      --MIME_boundary

      Content-Type: image/tiff
      Content-Transfer-Encoding: binary
      Content-ID: <car-photo@cars.example.com>

      ...binary TIFF image of the car...

      -MIME_boundary-

      However, what we produce is as follows:

      Content-Type:multipart/related; type="application/soap+xml"; boundary="MIME_boundary"; start="<car-data@cars.example.com>"; start-info="application/soap+xml"
      Accept:/
      User-Agent:Apache CXF 3.0.1
      Cache-Control:no-cache
      Pragma:no-cache
      Host:127.0.0.1:8080
      Connection:keep-alive

      --MIME_boundary

      Content-Type: text/xml; charset=UTF-8; type="application/soap+xml"
      Content-Transfer-Encoding: binary
      Content-ID: <car-data@cars.example.com>

      <?xml version='1.0' ?>
      <S12:Envelope xmlns:S12="http://www.w3.org/2003/05/soap-envelope"
      .
      .
      .
      </S12:Envelope>

      --MIME_boundary

      Content-Type: image/tiff
      Content-Transfer-Encoding: binary
      Content-ID: <car-photo@cars.example.com>

      ...binary TIFF image of the car...

      – MIME_boundary--

      The difference lies in the Content-Type of the root part, which is expected as application/soap+xml but set to text/xml. When testing against an Axis driven implementation we get the following error:

      Error while executing the transport Method RuntimeException: Invalid Content-Type: text/xml; charset=UTF-8; type="application/soap+xml"

      Our dispatch method looks like this:

      public SOAPMessage dispatch(final SOAPMessage soapMessage)

      { final QName serviceName = new QName("http://example.com", "msh-dispatch-service"); final QName portName = new QName("http://example.com", "msh-dispatch"); final javax.xml.ws.Service service = javax.xml.ws.Service.create(serviceName); service.addPort(portName, SOAPBinding.SOAP12HTTP_BINDING, "127.0.0.1:8080"); Dispatch<SOAPMessage> dispatch = service.createDispatch(portName, SOAPMessage.class, javax.xml.ws.Service.Mode.MESSAGE); Policy policy = policyFactory.parsePolicy("mypolicy.xml"); dispatch.getRequestContext().put(PolicyConstants.POLICY_OVERRIDE, policy); SOAPMessage result = dispatch.invoke(soapMessage); return result; }

      Attachments

        Issue Links

          Activity

            People

              ay Akitoshi Yoshida
              kochc Christian Koch
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: