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

hardcoded content type in AxisServlet response

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.5.1
    • None
    • transports
    • None
    • 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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              johnc john c
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: