Thanks a lot William. It worked !
Regards, Hari On Mon, Feb 18, 2013 at 8:54 PM, William Tam [via Camel] < ml-node+s465427n5727761...@n5.nabble.com> wrote: > 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 <[hidden > email]<http://user/SendEmail.jtp?type=node&node=5727761&i=0>> > 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. > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://camel.465427.n5.nabble.com/URL-overwriting-SOAP-vs-restful-tp5727526p5727761.html > To unsubscribe from URL overwriting - SOAP vs restful, click > here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5727526&code=amRldi5oYXJpQGdtYWlsLmNvbXw1NzI3NTI2fC0xMTAxNDI0Mzky> > . > NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://camel.465427.n5.nabble.com/URL-overwriting-SOAP-vs-restful-tp5727526p5727986.html Sent from the Camel - Users mailing list archive at Nabble.com.