> [
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 <a href="
http://activemq.apache.org/camel/cxf.html">CXF Component</a>
>
> * @version $Revision$
> */
> public class CxfComponent extends DefaultComponent<CxfExchange> {
> - 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 <a href="
http://activemq.apache.org/camel/cxf.html">CXF Component</a>
>
> * @version $Revision$
> */
> public class CxfComponent extends DefaultComponent<CxfExchange> {
> +
>
> 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<CxfExchange> {
> - 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<CxfExchange> {
> + 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 <a href="
http://activemq.apache.org/camel/cxf.html">CXF Endpoint</a>
> *
> * @version $Revision$
> */
> - public class CxfEndpoint extends DefaultEndpoint<CxfExchange> {
> 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<CxfExchange> createProducer() throws Exception {
> - return new CxfProducer(this, getLocalTransportFactory());
> }
>
> public Consumer<CxfExchange> 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 <a href="
http://activemq.apache.org/camel/cxf.html">CXF Endpoint</a>
> *
> * @version $Revision$
> */
> + public class CxfEndpoint extends DefaultEndpoint<CxfExchange> {
> + 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<CxfExchange> createProducer() throws Exception {
> + return new CxfProducer(this);
> }
>
> public Consumer<CxfExchange> 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
>>
>
>