I believe you can set the CamelDestinationOverrideUrl header to override the target service URL. It works for both SOAP (camel-cxf) and REST (camel-cxfrrs).
On Wed, Feb 13, 2013 at 10:45 AM, jdev.hari <jdev.h...@gmail.com> wrote: > Hi, > > I define my end point in camel context xml and during runtime I override > them as I get it from a Service catalogue service. > > For SOAP webservice invocations, I am able to do the following in a > processor just before the cxf bean invocation. > > Map<String, Object> requestContext = new HashMap<String, Object>(); > requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,endPointURL); > exchange.getOut().setHeader(Client.REQUEST_CONTEXT, requestContext); > > And this works as well. However if I try to do the same with restful > services. I get the following error (note, without overriding the call goes > through fine with restful services) > > Caused by: org.apache.camel.component.cxf.CxfOperationException: JAXRS > operation failed invoking direct://matching with statusCode: 404 > at > org.apache.camel.component.cxf.jaxrs.CxfRsProducer.populateCxfRsProducerException(CxfRsProducer.java:317) > at > org.apache.camel.component.cxf.jaxrs.CxfRsProducer.invokeHttpClient(CxfRsProducer.java:177) > at > org.apache.camel.component.cxf.jaxrs.CxfRsProducer.process(CxfRsProducer.java:87) > at > org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) > > I turned on the outgoing Webservice logging interceptor and I see the > following > > INFO : Outbound Message > --------------------------- > ID: 4 > Address: http://localhost:9084/yyy/services/ABC > Content-Type: */* > Headers: > {RequestContext=[{javax.xml.ws.service.endpoint.address=http://xxx:9080/yyy/services/ABC}], > Content-Type=[*/*], Connection=[Keep-Alive], Accept=[*/*]} > -------------------------------------- > > > The URL http://locahost:9084/yyy/services/ABC is present in camel endpoint > xml, whereas http://xxx:9080/yyy/services/ABC is the URL that needs to be > overridden. > > The same service if I model as SOAP based, the url overwriting works well. > The outgoing request was > > > INFO : Outbound Message > --------------------------- > ID: 2 > Address: http://XXX:9080/yyy/services/ABC > Encoding: UTF-8 > Content-Type: text/xml > Headers: {Accept=[*/*], Connection=[Keep-Alive], SOAPAction=[""]} > Payload: <soap:Envelope > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>......content > removed for brevity.......</soap:Envelope> > -------------------------------------- > > Any inputs on this. > > Regards, > Hari > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/URL-overwriting-SOAP-vs-restful-tp5727526.html > Sent from the Camel - Users mailing list archive at Nabble.com.