Axis2
  1. Axis2
  2. AXIS2-4786

hardcoded content type in AxisServlet response

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.5.1
    • Fix Version/s: None
    • Component/s: transports
    • Labels:
      None
    • Environment:
      Windows XP, JBoss 4.3, Spring Framework, Axis2 embedded in app war

      Description

      I get this error on the client side:
      Transport level information does not match with SOAP Message namespace URI
      at org.apache.axis2.builder.BuilderUtil.validateSOAPVersion(BuilderUtil.java:768)
      at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:62)
      at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:197)
      This happens because the response header Content-Type is text/xml.
      Background:
      I use Soap1.2. My request contains Content-Type: application/soap+xml;charset=UTF-8, doesn't have SOAPAction header (to avoid Soap1.1 processing) and the soap envelope is serialized by Soap1.2 formatter.

      On the server side I have the same setup: Soap1.2 formatter, the messageType on the response message context is set to application/soap+xml, I tried to set HTTP Content-Type header manually as per <a href="http://www.keith-chapman.org/2008/10/axis2-setting-custom-http-headers-on.html">here</a>.
      I have disabled REST in axis2.xml and enabled content negotiation, but that didn't fix anything.

      The problem is that the org.apache.axis2.transport.http.AxisServlet class hardcodes the contenttype on line 160:
      response.setContentType("text/xml; charset="
      + msgContext
      .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING));

      I suggest replacing "text/xml" part with msgContext.getProperty(Constants.MESSAGE_TYPE) and hardcoding if not set.

        Issue Links

          Activity

          Hide
          Andreas Veithen added a comment -

          Duplicate of AXIS2-4712.

          Show
          Andreas Veithen added a comment - Duplicate of AXIS2-4712 .

            People

            • Assignee:
              Unassigned
              Reporter:
              john c
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development