Return-Path: Delivered-To: apmail-activemq-camel-dev-archive@locus.apache.org Received: (qmail 92085 invoked from network); 28 Aug 2007 15:14:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Aug 2007 15:14:46 -0000 Received: (qmail 67027 invoked by uid 500); 28 Aug 2007 15:14:42 -0000 Delivered-To: apmail-activemq-camel-dev-archive@activemq.apache.org Received: (qmail 66987 invoked by uid 500); 28 Aug 2007 15:14:42 -0000 Mailing-List: contact camel-dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-dev@activemq.apache.org Delivered-To: mailing list camel-dev@activemq.apache.org Received: (qmail 66978 invoked by uid 99); 28 Aug 2007 15:14:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Aug 2007 08:14:41 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Aug 2007 15:15:38 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6071D71418F for ; Tue, 28 Aug 2007 08:14:22 -0700 (PDT) Message-ID: <8345274.1188314062392.JavaMail.jira@brutus> Date: Tue, 28 Aug 2007 08:14:22 -0700 (PDT) From: "James Strachan (JIRA)" To: camel-dev@activemq.apache.org Subject: [jira] Commented: (CAMEL-118) Camel CXF Invoker component support In-Reply-To: <31724568.1187940142132.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/CAMEL-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40033 ] James Strachan commented on CAMEL-118: -------------------------------------- Here are the rejections from TextMate (which seems to give the best rejection messages) {code} *************** *** 16,42 **** */ package org.apache.camel.component.cxf; - import java.net.URI; import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.impl.DefaultComponent; - import org.apache.cxf.Bus; - import org.apache.cxf.BusException; - import org.apache.cxf.bus.CXFBusFactory; - import org.apache.cxf.service.model.EndpointInfo; - import org.apache.cxf.transport.DestinationFactoryManager; - import org.apache.cxf.transport.local.LocalTransportFactory; - import org.xmlsoap.schemas.wsdl.http.AddressType; /** * Defines the CXF Component * @version $Revision$ */ public class CxfComponent extends DefaultComponent { - private LocalTransportFactory localTransportFactory; public CxfComponent() { } --- 16,36 ---- */ package org.apache.camel.component.cxf; import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.impl.DefaultComponent; + import org.apache.camel.util.IntrospectionSupport; + /** * Defines the CXF Component * @version $Revision$ */ public class CxfComponent extends DefaultComponent { + public CxfComponent() { } {code} {code} *************** *** 18,72 **** import org.apache.camel.Processor; import org.apache.camel.impl.DefaultConsumer; import org.apache.cxf.message.Message; import org.apache.cxf.transport.Destination; import org.apache.cxf.transport.MessageObserver; - import org.apache.cxf.transport.local.LocalTransportFactory; /** * A consumer of exchanges for a service in CXF * * @version $Revision$ */ public class CxfConsumer extends DefaultConsumer { - private CxfEndpoint endpoint; - private final LocalTransportFactory transportFactory; private Destination destination; - public CxfConsumer(CxfEndpoint endpoint, Processor processor, LocalTransportFactory transportFactory) { super(endpoint, processor); this.endpoint = endpoint; - this.transportFactory = transportFactory; } @Override protected void doStart() throws Exception { - super.doStart(); - - destination = transportFactory.getDestination(endpoint.getEndpointInfo()); - destination.setMessageObserver(new MessageObserver() { - public void onMessage(Message message) { - incomingCxfMessage(message); - } - }); } @Override protected void doStop() throws Exception { - if (destination != null) { - destination.shutdown(); - } super.doStop(); } - protected void incomingCxfMessage(Message message) { - try { - CxfExchange exchange = endpoint.createExchange(message); - getProcessor().process(exchange); - } catch (Exception e) { - // TODO: what do do if we are getting processing errors from camel? - // Shutdown? - e.printStackTrace(); - } - } } --- 18,71 ---- import org.apache.camel.Processor; import org.apache.camel.impl.DefaultConsumer; + import org.apache.cxf.endpoint.Server; + import org.apache.cxf.frontend.ServerFactoryBean; import org.apache.cxf.message.Message; import org.apache.cxf.transport.Destination; import org.apache.cxf.transport.MessageObserver; + /** * A consumer of exchanges for a service in CXF * * @version $Revision$ */ public class CxfConsumer extends DefaultConsumer { + private CxfEndpoint endpoint; + private Server server; private Destination destination; + public CxfConsumer(CxfEndpoint endpoint, Processor processor) throws ClassNotFoundException { + super(endpoint, processor); + System.out.println(processor.toString()); this.endpoint = endpoint; + //we setup the interceptors by the endpoint configuration + //create server here, now we just use the simple front-end + ServerFactoryBean svrBean = new ServerFactoryBean(); + Class serviceClass = Class.forName(endpoint.getServiceClass()); + svrBean.setAddress(endpoint.getAddress()); + svrBean.setServiceClass(serviceClass); + if (endpoint.isInvoker()) { + System.out.println("setup the invoker "); + svrBean.setInvoker(new CamelInvoker(this)); + } + svrBean.setStart(false); + server = svrBean.create(); } @Override protected void doStart() throws Exception { + super.doStart(); + + server.start(); } @Override protected void doStop() throws Exception { + server.stop(); super.doStop(); } + } {code} {code} *************** *** 16,53 **** */ package org.apache.camel.component.cxf; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.impl.DefaultEndpoint; - import org.apache.cxf.BusException; import org.apache.cxf.message.Message; - import org.apache.cxf.service.model.EndpointInfo; - import org.apache.cxf.transport.local.LocalTransportFactory; /** * Defines the CXF Endpoint * * @version $Revision$ */ - public class CxfEndpoint extends DefaultEndpoint { private CxfBinding binding; - private final CxfComponent component; - private final EndpointInfo endpointInfo; private boolean inOut = true; - public CxfEndpoint(String uri, CxfComponent component, EndpointInfo endpointInfo) { super(uri, component); - this.component = component; - this.endpointInfo = endpointInfo; } - public Producer createProducer() throws Exception { - return new CxfProducer(this, getLocalTransportFactory()); } public Consumer createConsumer(Processor processor) throws Exception { - return new CxfConsumer(this, processor, getLocalTransportFactory()); } public CxfExchange createExchange() { --- 16,59 ---- */ package org.apache.camel.component.cxf; + import javax.xml.namespace.QName; + import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.impl.DefaultEndpoint; + import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.message.Message; + /** * Defines the CXF Endpoint * * @version $Revision$ */ + public class CxfEndpoint extends DefaultEndpoint { + private final CxfComponent component; + private final String address; + private String wsdlURL; + private String serviceClass; private CxfBinding binding; + private QName portName; + private QName serviceName; private boolean inOut = true; + private boolean invoker = true; + public CxfEndpoint(String uri, String address, CxfComponent component) { super(uri, component); + this.component = component; + this.address = address; } + public Producer createProducer() throws Exception { + return new CxfProducer(this); } public Consumer createConsumer(Processor processor) throws Exception { + return new CxfConsumer(this, processor); } public CxfExchange createExchange() { {code} > Camel CXF Invoker component support > ----------------------------------- > > Key: CAMEL-118 > URL: https://issues.apache.org/activemq/browse/CAMEL-118 > Project: Apache Camel > Issue Type: Sub-task > Components: camel-cxf > Reporter: Willem Jiang > Fix For: 1.2.0 > > Attachments: cxf.patch, cxf.patch2, filestates, svn-rm.patch > > > CXFProducer holds the CXF client's reference,CXFConsumer holds the CXF server's reference, Now I just wrote a router test which redirect a service request from CXFService A to CXFService B > I attached a patch and a svn state out put which would be helpful to verify the files statues -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.