Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5FA1718898 for ; Fri, 18 Dec 2015 16:24:32 +0000 (UTC) Received: (qmail 10147 invoked by uid 500); 18 Dec 2015 16:24:27 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 10114 invoked by uid 500); 18 Dec 2015 16:24:27 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 10101 invoked by uid 99); 18 Dec 2015 16:24:26 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Dec 2015 16:24:26 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 4565D1A1373 for ; Fri, 18 Dec 2015 16:24:26 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 4.016 X-Spam-Level: **** X-Spam-Status: No, score=4.016 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, KAM_ASCII_DIVIDERS=0.8, KAM_BADIPHTTP=2, NORMAL_HTTP_TO_IP=0.001, URIBL_BLOCKED=0.001, URI_HEX=1.313, WEIRD_PORT=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id WgNYoXEyew0Q for ; Fri, 18 Dec 2015 16:24:14 +0000 (UTC) Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 1BC59429C2 for ; Fri, 18 Dec 2015 16:24:14 +0000 (UTC) Received: by mail-wm0-f54.google.com with SMTP id p187so70349596wmp.1 for ; Fri, 18 Dec 2015 08:24:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=RG1CNG0akRV6UQFlFe2fJ/OQMQc7MHVMqdgknnX60BM=; b=pXl1o42X9oMAiWWckXW0x8mUlUs6iqrv9jA+3giJHxj7lnlhl/wwNyuGGVXuGArMMc mW8z0+rnPpM4ZNcFJp9USYa24gLc5+qPbuPsG2mCC/kHWml2CUXYq/Y4PxOsvPIJ+ebK Ta6+dl79f8uxpVRKPm+304V+g1bttOXIO987w8c2WOtbke0FfUjQbBSgi+FS/6IUbwub 5HigJA41GWdUPaRjxfTvTfLx5zYUy0FWlVEFvV3HPxCsRyaNbMHDZ73X2/6kqoljfHdk AgmGmL8SZPtyL0TsTdhrkJct08ML/XWTFHucQ73bWqS+qV0RFvO2uoSL4O/8uOJhEe4x F/Zw== X-Received: by 10.194.121.35 with SMTP id lh3mr5012114wjb.164.1450455853195; Fri, 18 Dec 2015 08:24:13 -0800 (PST) Received: from [192.168.2.7] ([46.7.211.124]) by smtp.googlemail.com with ESMTPSA id 193sm7343160wmp.16.2015.12.18.08.24.11 for (version=TLSv1/SSLv3 cipher=OTHER); Fri, 18 Dec 2015 08:24:12 -0800 (PST) Subject: Re: How to configure cxf rsclient bean in Java dsl? To: users@camel.apache.org References: <1450431303790-5775242.post@n5.nabble.com> From: Sergey Beryozkin Message-ID: <5674332C.3030302@gmail.com> Date: Fri, 18 Dec 2015 16:24:12 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <1450431303790-5775242.post@n5.nabble.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Hi - JAXRSClientFactoryBean can be initialized with the headers too, so please try that as a workaround. CXF RS client component should be capable of checking Camel headers too, will have a look when I get a chance Sergey On 18/12/15 09:35, VivekDhayalan wrote: > I want to define cxf:rsclient in Java dsl instead of xml based dsl. > I have the following defined in Java dsl. > > from("direct:fromChannel") > .split() > .tokenizeXML("APIDataMessage").streaming() > .unmarshal(jaxb) > .convertBodyTo(com.testing.camel.MeasureEvent.class) > .setHeader("Content-Type", constant("application/json")) > .to("cxfrs://bean://toClient"); > > And I have the following for RSClient > > @Bean > public SpringJAXRSClientFactoryBean toClient() > { > SpringJAXRSClientFactoryBean springJAXRSClientFactoryBean = new > SpringJAXRSClientFactoryBean(); > String measurementEventURL = "http://" + connectorsConfig.getHost() + > ":" + connectorsConfig.getPort() + "/api/measurementEvents"; > > springJAXRSClientFactoryBean.setBeanId("toClient"); > springJAXRSClientFactoryBean.setAddress(measurementEventURL); > > springJAXRSClientFactoryBean.setServiceClass(com.testing.camel.MeasurementEventEndpoint.class); > springJAXRSClientFactoryBean.setLoggingFeatureEnabled(true); > springJAXRSClientFactoryBean.setSkipFaultLogging(true); > springJAXRSClientFactoryBean.setProvider(jsonProvider()); > return springJAXRSClientFactoryBean; > } > > And here is my jsonProvider definition: > > JacksonJsonProvider jsonProvider() > { > return new JacksonJsonProvider(); > } > > And following is the stacktrace that I see while calling this route. > > Stacktrace > --------------------------------------------------------------------------------------------------------------------------------------- > > org.apache.camel.component.cxf.CxfOperationException: JAXRS operation > failed invoking http://0.0.0.0:8089/monnitmysqltsdb?restletMethods=POST with > statusCode: 405 > at > org.apache.camel.component.cxf.jaxrs.CxfRsProducer.populateCxfRsProducerException(CxfRsProducer.java:419) > at > org.apache.camel.component.cxf.jaxrs.CxfRsProducer.invokeHttpClient(CxfRsProducer.java:232) > at > org.apache.camel.component.cxf.jaxrs.CxfRsProducer.process(CxfRsProducer.java:89) > at > org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) > at > org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:169) > at > org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:341) > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:164) > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:121) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) > at > org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:668) > at > org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:596) > at > org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:237) > at org.apache.camel.processor.Splitter.process(Splitter.java:104) > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) > at > org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62) > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141) > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) > at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109) > at > org.apache.camel.processor.MulticastProcessor.doProcessParallel(MulticastProcessor.java:814) > at > org.apache.camel.processor.MulticastProcessor.access$200(MulticastProcessor.java:84) > at > org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:314) > at > org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:299) > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > at java.lang.Thread.run(Thread.java:745) > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/How-to-configure-cxf-rsclient-bean-in-Java-dsl-tp5775242.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Sergey Beryozkin Talend Community Coders http://coders.talend.com/