Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-3806

SOAPAction HTTP header value not copied correctly to from CXF message to Camel message header

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6.0
    • 2.7.3, 2.8.0
    • camel-cxf
    • camel-cxf, CXF consumer endpoint with PAYLOAD data format

    Description

      When using camel-cxf consumer endpoint with PAYLOAD data format, the SoapActionInInterceptor correctly strips off any double quotes surrounding the SOAPAction header value, e.g:

      SOAPAction: "http://apache.org/hello_world_soap_http/greetMe"
      

      and then sets this header on the message again:

      SoapActionInInterceptor.java
      public void handleMessage(SoapMessage message) throws Fault {
              String action = getSoapAction(message);
              if (!StringUtils.isEmpty(action)) {
                  getAndSetOperation(message, action);
              }
          }
      

      After the execution of getAndSetOperation(message, action), there are two SOAPAction headers set on the message. The original SOAPAction header value (with surrounding quotes) is part of the org.apache.cxf.message.Message.PROTOCOL_HEADERS. In addition the getAndSetOperation() method also adds
      SOAPAction=http://apache.org/hello_world_soap_http/greetMe header (without surrounding quotes).

      Later in org.apache.camel.component.cxf.DefaultCxfBinding.propagateHeadersFromCxfToCamel(), when the CXF message headers get copied to the Camel message, it only retrieves the org.apache.cxf.message.Message.PROTOCOL_HEADERS:

      Map<String, List<String>> cxfHeaders = (Map)cxfMessage.get(Message.PROTOCOL_HEADERS);
      

      The SOAPAction header in PROTOCOL_HEADERS wasn't changed by the SoapActionInInterceptor and hence still has enclosed double quotes. These headers then get copied to the Camel In message headers. The header that was set by the SoapActionInInterceptor SOAPAction=http://apache.org/hello_world_soap_http/greetMe does not get copied!

      If later in a Camel route a custom Camel Processor tries to resolve this SOAPAction header, it gets the the value with surrounding double quotes, but these should actually have been stripped off.

      This behavior is a bug.

      Attachments

        1. testcase.zip
          10 kB
          Torsten Mielke

        Activity

          People

            njiang Willem Jiang
            tmielke Torsten Mielke
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: