Hi Sergey, I tried all the above options and still id doesnt work.
Thanks, Hari On Wed, Feb 13, 2013 at 10:42 AM, Sergey Beryozkin-3 [via Camel] < ml-node+s465427n5727536...@n5.nabble.com> wrote: > Actually, you mentioned that > > >> Map<String, Object> requestContext = new HashMap<String, Object>(); > >> > requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,endPointURL); > >> > >> exchange.getOut().setHeader(Client.REQUEST_CONTEXT, requestContext); > > actually affects the RS path too - I can see WS & RS request context > property is actually named identically (in CXF code). So give it another > try with the above code but replace > > requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,endPointURL); > > with > > requestContext.put("org.apache.cxf.request.uri",endPointURL); > > and possibly add > > requestContext.put(Message.ENDPOINT_ADDRESS,endPointURL); > > > if that does not work then then we can take it offline to minimize the > noise - actually, if that does not work still - have a look in the > debugger and make sure that whatever properties are set there which make > the invocation work as expected are reset to the new values and not > lost, AFAIK, CXF RS runtime has a default request context on the message > already set...so may be you have to do > > exchange.getOut().getHeader(Client.REQUEST_CONTEXT) and if the context > is not null then update request uri and endpoint address on it > > Cheers, Sergey > > On 13/02/13 16:15, Sergey Beryozkin wrote: > > > Hi, > > On 13/02/13 15:45, jdev.hari 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) > >> > > BindingProvider.ENDPOINT_ADDRESS_PROPERTY is not recognized by the > > client RS runtime, can you try > > > > final String REQUEST_URI = "org.apache.cxf.request.uri"; > > exchange.getOut().setHeader(REQUEST_URI, endPointURL); > > > > Not sure if it will work in Camel right now, though I'm pretty sure we > > have a CXF test for changing the original address, let me know please > > > > Cheers, Sergey > > > >> 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. > > > -- > Sergey Beryozkin > > Talend Community Coders > http://coders.talend.com/ > > Blog: http://sberyozkin.blogspot.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-tp5727526p5727536.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-tp5727526p5727758.html Sent from the Camel - Users mailing list archive at Nabble.com.