Cannot send HTTP headers with Camel URI binding + Camel-HTTP in SwitchYard
Issue
- One of the external web service calls needs a session token and other dynamic parameters to be appended as query string to WS URL.
- The HTTP proxy approach described in this solution -- How to switch SOAP endpoints dynamically at runtime for SOAP reference bindings in SwitchYard -- was used for implementing a dynamic endpoint in SOAP request using Camel URI binding and Camel HTTP component.
- However, HTTP headers in a SwitchYard request miss a few items like
"SOAPAction"
,"Content-Type"
,"Accept-Encoding"
, etc. when compared with SoapUI, hence the call fails. -
Here is part of the
switchyard.xml
:<camel_1:binding.uri name="Camel2" configURI="http://www.example.com/ws/myservice"> <camel_1:contextMapper includes="CamelHttp.*"></camel_1:contextMapper> </camel_1:binding.uri>
-
The Camel route (Java DSL):
exchange.getOut().setHeader(Exchange.SOAP_ACTION, "doThis"); exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/soap+xml;charset=UTF-8;action=\"doThis\"");
Environment
- Red Hat JBoss Fuse Service Works (FSW)
- 6.0.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.