Skip to content
Advertisement

Quotation marks in Camel Content-Type header

I am trying to invoke a SOAP service using camel-http4. This service requires me to send the following header: Content-Type: application/soap+xml;charset=UTF-8;action=”ListBerichten”. I have to include the quotation marks, or otherwise the service will return a 400 code

When I try this with a client like Postman or SoapUI or curl it works fine, but when I try it with Camel, it fails to recognize the ‘action’.

(the curl header looks like this) --header 'Content-Type: application/soap+xml;charset=UTF-8;action="ListBerichten"'

I suspect it has something to do with the quotation marks around ListBerichten, but I can’t figure out what it is.

My Camel Route (I’m using a custom http4 implementation for SSL configuration):

JavaScript

and my properties

JavaScript

And the response I get:

JavaScript

I’ve tried escaping the quotes with backslashes, replacing the quotes with UTF-8 encoded characters, setting the header as a String literal and setting the ‘action’ in a separate header but nothing seems to work. How do I need to deal with the quotation marks in the Content-Type header?

Advertisement

Answer

The action parameter is the default way to set the SOAP Action in SOAP version 1.2. The HTTP component parses the content-type values however. Alternative you can use:

  1. netty-http component (since Camel 2.14)
  2. vertx-http component (since Camel 3.5)

Both components don’t parse the header values.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement