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 C314F9B3E for ; Sat, 28 Jul 2012 01:23:39 +0000 (UTC) Received: (qmail 23550 invoked by uid 500); 28 Jul 2012 01:23:39 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 23524 invoked by uid 500); 28 Jul 2012 01:23:39 -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 23514 invoked by uid 99); 28 Jul 2012 01:23:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Jul 2012 01:23:38 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of willem.jiang@gmail.com designates 209.85.160.45 as permitted sender) Received: from [209.85.160.45] (HELO mail-pb0-f45.google.com) (209.85.160.45) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Jul 2012 01:23:32 +0000 Received: by pbbro12 with SMTP id ro12so6666180pbb.32 for ; Fri, 27 Jul 2012 18:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=qyzkWkIfwj5IQ1LcP8IR+MhWNVy8SMDlMN4517xM9mM=; b=UylgmlATl9lvIKQOnEBnUimJfaHYiDpJWD1WOo1S2a1ne9yW1y5CcLj3jtSppD4KDz UlH1XshPoijG3tLIg3DYTCw10cnbwxssckdroF6PjL/0wadPQNqFXrfQMVHZP/Ptpjfy z5AqqSjHRre7D2kS8VTv0ZAxJIzTzd+XnBOYkV1B/M9oRTuMu84pqNTgagcV3Sc4q5s8 6Z8NbnLVW4HOXhf/zVcw93hOmQB18kNj/dzVo0umsOIOBgYC7+6J/oFgeor/gZXomJxh co3uqhEq3duT2vEDjhfkS9gjihOyzAciDoQm83MIYi7tDm3lh4K1kQLtKlU3OYTe5bgL qZGA== Received: by 10.68.224.233 with SMTP id rf9mr18015174pbc.141.1343438590483; Fri, 27 Jul 2012 18:23:10 -0700 (PDT) Received: from [192.168.0.158] ([123.116.39.38]) by mx.google.com with ESMTPS id ku7sm2929305pbc.31.2012.07.27.18.23.07 (version=SSLv3 cipher=OTHER); Fri, 27 Jul 2012 18:23:08 -0700 (PDT) Message-ID: <50133EF9.7080006@gmail.com> Date: Sat, 28 Jul 2012 09:23:05 +0800 From: Willem Jiang User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: users@camel.apache.org Subject: Re: How to invoke CXF webservice from processor bean References: <1342748062799-5716272.post@n5.nabble.com> <1343427476566-5716569.post@n5.nabble.com> In-Reply-To: <1343427476566-5716569.post@n5.nabble.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Yeah, this example is setting the right headers on the message which is passed by the exchange. On Sat Jul 28 06:17:56 2012, ychawla wrote: > I have something like this working in a unit test. Maybe you can try > something similar: > > public static final String CXF_OPERATION_NAME = "operation"; > public static final String CXF_OPERATION_NAMESPACE = "http://opNamespace"; > > @Test > @DirtiesContext > public void myTest() throws Exception > { > > String > pathToFileForExchangeBody="src/test/resources/xmlInstances/mypayload.xml"; > > Exchange senderExchange = createCXFExchange(pathToFileForExchangeBody); > > //Send the one-way exchange. Using template.send will send a one way > message > Exchange returnExchange = > template.send("cxf:bean:mybean?dataFormat=PAYLOAD&loggingFeatureEnabled=true&synchronous=true", > senderExchange); > > //Use getException to see if we received an exception > if (returnExchange.getException() != null) > { > throw new Exception(returnExchange.getException()); > } > } > > private Exchange createCXFExchange(String pathToFileForExchangeBody) > { > //Create a new exchange > Exchange senderExchange = new DefaultExchange(context); > > //Set the operation name and operation namespace for the CXF exchange > senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, > CXF_OPERATION_NAME); > senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, > CXF_OPERATION_NAMESPACE); > > //Read the icotns request file from the file system, this one has no > endpoint to route to > File inputFile = new File(pathToFileForExchangeBody); > > assertTrue(inputFile.exists()); > log.debug("Does input file exist: " + inputFile.exists()); > > //Set it as the message message body > senderExchange.getIn().setBody(inputFile); > > return senderExchange; > > } > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716569.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Willem ---------------------------------- FuseSource Web: http://www.fusesource.com Blog: http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang Weibo: willemjiang