camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r583092 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/util/ camel-core/src/test/java/org/apache/camel/util/ components/camel-cxf/ components/camel-cxf/src/main/java/org...
Date Tue, 09 Oct 2007 10:18:04 GMT
Author: jstrachan
Date: Tue Oct  9 03:17:57 2007
New Revision: 583092

URL: http://svn.apache.org/viewvc?rev=583092&view=rev
Log:
applied patch for CAMEL-119 from Willem Jiang with thanks!

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java   (with props)
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/util/UnsafeCharactersEncoderTest.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/NamespaceHandler.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/resources/META-INF/spring.handlers
    activemq/camel/trunk/components/camel-cxf/src/main/resources/META-INF/spring.schemas
    activemq/camel/trunk/components/camel-cxf/src/main/resources/schema/
    activemq/camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFRouterSpringTest.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/resources/org/
    activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/
    activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/
    activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/
    activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/
    activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/
    activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml   (with props)
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
    activemq/camel/trunk/components/camel-cxf/pom.xml
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapConsumer.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/AbstractInvokingContext.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/RawMessageInvokingContext.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java Tue Oct  9 03:17:57 2007
@@ -29,6 +29,7 @@
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.URISupport;
+import org.apache.camel.util.UnsafeUriCharactersEncoder;
 
 /**
  * @version $Revision$
@@ -48,9 +49,8 @@
 
     public Endpoint<E> createEndpoint(String uri) throws Exception {
         ObjectHelper.notNull(getCamelContext(), "camelContext");
-        //TODO endcode uri sting to the unsafe URI string
-        
-        URI u = new URI(uri);
+        //endcode uri sting to the unsafe URI characters        
+        URI u = new URI(UnsafeUriCharactersEncoder.encode(uri));
         String path = u.getSchemeSpecificPart();
 
         // lets trim off any query arguments

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java Tue Oct  9 03:17:57 2007
@@ -0,0 +1,101 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.util;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.CharacterCodingException;
+import java.util.BitSet;
+
+import sun.nio.cs.ThreadLocalCoders;
+import sun.text.Normalizer;
+
+public class UnsafeUriCharactersEncoder {
+    static BitSet unsafeCharacters;
+    static {
+        unsafeCharacters = new BitSet(256);
+        unsafeCharacters.set(' ');
+        unsafeCharacters.set('"');
+        unsafeCharacters.set('<');
+        unsafeCharacters.set('>');
+        unsafeCharacters.set('#');
+        unsafeCharacters.set('%');
+        unsafeCharacters.set('{');
+        unsafeCharacters.set('}');
+        unsafeCharacters.set('|');
+        unsafeCharacters.set('\\');
+        unsafeCharacters.set('^');
+        unsafeCharacters.set('~'); 
+        unsafeCharacters.set('[');
+        unsafeCharacters.set(']');
+        unsafeCharacters.set('`');        
+    }
+    
+    
+    private UnsafeUriCharactersEncoder() {
+        // util class 
+    }
+    
+    public static String encode(String s) {
+        int n = s.length();
+        if (n == 0)
+            return s;
+        
+        // First check whether we actually need to encode
+        byte[] bytes = s.getBytes();
+        for (int i = 0;;) {
+            if (unsafeCharacters.get(bytes[i]))
+                break;
+            if (++i >= bytes.length)
+                return s;
+        }
+        
+        String ns = Normalizer.normalize(s, Normalizer.COMPOSE, 0);        
+        ByteBuffer bb = null;
+        try {
+            bb = ThreadLocalCoders.encoderFor("UTF-8")
+                .encode(CharBuffer.wrap(ns));
+        } catch (CharacterCodingException x) {
+            assert false;
+        }
+
+        StringBuffer sb = new StringBuffer();
+        while (bb.hasRemaining()) {
+            int b = bb.get() & 0xff;
+            if (unsafeCharacters.get(b)) {
+                appendEscape(sb, (byte)b);
+            }    
+            else
+                sb.append((char)b);
+        }
+        return sb.toString();
+    }
+    
+    private static void appendEscape(StringBuffer sb, byte b) {
+        sb.append('%');
+        sb.append(hexDigits[(b >> 4) & 0x0f]);
+        sb.append(hexDigits[(b >> 0) & 0x0f]);
+    }
+    
+    private final static char[] hexDigits = {
+                                        '0', '1', '2', '3', '4', '5', '6', '7',
+                                        '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+                                         };
+    
+      
+
+}

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/util/UnsafeCharactersEncoderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/util/UnsafeCharactersEncoderTest.java?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/util/UnsafeCharactersEncoderTest.java (added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/util/UnsafeCharactersEncoderTest.java Tue Oct  9 03:17:57 2007
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.util;
+
+import junit.framework.TestCase;
+
+public class UnsafeCharactersEncoderTest extends TestCase {
+     public void testQnameEncoder() {
+         String afterEncoding = "%7Bhttp://www.example.com/test%7DServiceName";
+         String beforeEncoding = "{http://www.example.com/test}ServiceName";
+         
+         String result = UnsafeUriCharactersEncoder.encode(beforeEncoding);
+         System.out.println("result " + result);
+         assertEquals("Get the wrong encoding result", result, afterEncoding);
+     }
+    
+}

Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/util/UnsafeCharactersEncoderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/components/camel-cxf/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/pom.xml?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/pom.xml (original)
+++ activemq/camel/trunk/components/camel-cxf/pom.xml Tue Oct  9 03:17:57 2007
@@ -51,6 +51,17 @@
     </dependency>
 
     <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>      
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+      <type>test-jar</type>      
+    </dependency>
+
+    <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging-api</artifactId>
     </dependency>
@@ -172,15 +183,13 @@
     <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
-       <version>${spring-version}</version>
-       <scope>test</scope>
+       <version>${spring-version}</version>       
      </dependency>
     
     <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
-       <version>${spring-version}</version>
-       <scope>test</scope>
+       <version>${spring-version}</version>       
      </dependency>
 
 

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java Tue Oct  9 03:17:57 2007
@@ -31,6 +31,7 @@
     String PORT_NAME = "portName";
     String PROTOCOL_NAME_RES = "res";
     String OPERATION_NAME = "operationName";
+    String SPRING_CONTEXT_ENDPOINT = "bean:";
     // service name -- come from the wsdl   
 }
 

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java Tue Oct  9 03:17:57 2007
@@ -19,9 +19,11 @@
 import java.net.URI;
 
 import org.apache.camel.Processor;
+import org.apache.camel.component.cxf.spring.CxfEndpointBean;
 import org.apache.camel.component.cxf.util.CxfEndpointUtils;
 import org.apache.camel.component.cxf.util.UriUtils;
 import org.apache.camel.impl.DefaultConsumer;
+import org.apache.camel.spring.SpringCamelContext;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
@@ -46,22 +48,40 @@
     public CxfConsumer(CxfEndpoint endpoint, Processor processor) throws Exception {
        
         super(endpoint, processor);        
-        this.endpoint = endpoint;
+        this.endpoint = endpoint;        
+        
         try {
             // now we just use the default bus here   
             Bus bus = BusFactory.getDefaultBus();
-            Class serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass()); 
-            ServerFactoryBean svrBean = CxfEndpointUtils.getServerFactoryBean(serviceClass);                           
-            svrBean.setAddress(endpoint.getAddress());
-            svrBean.setServiceClass(serviceClass);
-            if (endpoint.getServiceName() != null) {
-                svrBean.getServiceFactory().setServiceName(CxfEndpointUtils.getServiceName(endpoint));                
-            }
-            if (endpoint.getPortName() != null) {
-                svrBean.getServiceFactory().setEndpointName(CxfEndpointUtils.getPortName(endpoint));
-            }    
-            if (endpoint.getWsdlURL() != null) {                
-                svrBean.setWsdlURL(endpoint.getWsdlURL());
+            ServerFactoryBean svrBean = null;
+            if (endpoint.isSpringContextEndpoint()) {
+                CxfEndpointBean endpointBean = endpoint.getCxfEndpointBean();
+                svrBean = CxfEndpointUtils.getServerFactoryBean(endpointBean.getServiceClass());
+                endpoint.configure(svrBean);
+                //Need to set the service name and endpoint name to the ClientFactoryBean's service factory
+                // to walk around the issue of setting EndpointName and ServiceName
+                CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
+                if (cxfEndpointBean.getServiceName() != null) {
+                    svrBean.getServiceFactory().setServiceName(cxfEndpointBean.getServiceName());
+                } 
+                if (cxfEndpointBean.getEndpointName() != null) {
+                    svrBean.getServiceFactory().setEndpointName(cxfEndpointBean.getEndpointName());
+                } 
+                
+            } else { // setup the serverFactoryBean with the URI paraments           
+                Class serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass()); 
+                svrBean = CxfEndpointUtils.getServerFactoryBean(serviceClass);                           
+                svrBean.setAddress(endpoint.getAddress());
+                svrBean.setServiceClass(serviceClass);
+                if (endpoint.getServiceName() != null) {
+                    svrBean.getServiceFactory().setServiceName(CxfEndpointUtils.getServiceName(endpoint));                
+                }
+                if (endpoint.getPortName() != null) {
+                    svrBean.getServiceFactory().setEndpointName(CxfEndpointUtils.getPortName(endpoint));
+                }    
+                if (endpoint.getWsdlURL() != null) {                
+                    svrBean.setWsdlURL(endpoint.getWsdlURL());
+                }
             }
             DataFormat dataFormat = CxfEndpointUtils.getDataFormat(endpoint);
             if (dataFormat.equals(DataFormat.POJO)) {
@@ -78,6 +98,7 @@
             } 
             
         } catch (Exception ex) {
+            // create Consumer endpoint failed
             ex.printStackTrace();
         }
     }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Tue Oct  9 03:17:57 2007
@@ -16,13 +16,19 @@
  */
 package org.apache.camel.component.cxf;
 
+import java.net.URI;
+import java.net.URISyntaxException;
+
 import javax.xml.namespace.QName;
 
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.ExchangePattern;
+import org.apache.camel.component.cxf.spring.CxfEndpointBean;
 import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spring.SpringCamelContext;
+import org.apache.cxf.configuration.spring.ConfigurerImpl;
 import org.apache.cxf.message.Message;
 
 
@@ -40,13 +46,29 @@
     private String portName;
     private String serviceName;
     private String dataFormat;
+    private String beanId;
+    private boolean isSpringContextEndpoint;
     private boolean inOut = true;
+    private ConfigurerImpl configurer;
+    private CxfEndpointBean cxfEndpointBean;
     
 
     public CxfEndpoint(String uri, String address, CxfComponent component) {
         super(uri, component);
         this.component = component;        
         this.address = address;
+        if (address.startsWith(CxfConstants.SPRING_CONTEXT_ENDPOINT)) {
+            isSpringContextEndpoint = true;
+            //get the bean from spring context
+            beanId = address.substring(CxfConstants.SPRING_CONTEXT_ENDPOINT.length());
+            if (beanId.startsWith("//")) {
+               beanId = beanId.substring(2);     
+            }
+            SpringCamelContext context = (SpringCamelContext) this.getContext();
+            configurer = new ConfigurerImpl(context.getApplicationContext()); 
+            cxfEndpointBean = (CxfEndpointBean) context.getApplicationContext().getBean(beanId);
+            assert(cxfEndpointBean != null);
+        }
     }
         
     public Producer<CxfExchange> createProducer() throws Exception {
@@ -77,6 +99,9 @@
         dataFormat = format;
     }
     
+    public boolean isSpringContextEndpoint() {
+        return isSpringContextEndpoint;
+    }
         
     public String getAddress() {
     	return address;
@@ -91,7 +116,8 @@
     }
     
     public String getServiceClass() {
-    	return serviceClass;
+        return serviceClass;
+    	
     }
     
     public void setServiceClass(String className) {        
@@ -142,6 +168,17 @@
         return true;
     }
     
+    public String getBeanId() {
+        return beanId;
+    }
+    
+    public CxfEndpointBean getCxfEndpointBean() {
+        return cxfEndpointBean;
+    }
+    
+    public void configure(Object beanInstance) {
+        configurer.configureBean(beanId, beanInstance);
+    }
     
 
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Tue Oct  9 03:17:57 2007
@@ -24,6 +24,7 @@
 import org.apache.camel.component.cxf.invoker.CxfClient;
 import org.apache.camel.component.cxf.invoker.CxfClientFactoryBean;
 import org.apache.camel.component.cxf.invoker.InvokingContext;
+import org.apache.camel.component.cxf.spring.CxfEndpointBean;
 import org.apache.camel.component.cxf.util.CxfEndpointUtils;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.util.ObjectHelper;
@@ -60,7 +61,6 @@
         super(endpoint);
         this.endpoint = endpoint;
         dataFormat = CxfEndpointUtils.getDataFormat(endpoint);
-        
         if (dataFormat.equals(DataFormat.POJO)) {
             client = createClientFormClientFactoryBean(null);
         } else {
@@ -84,49 +84,63 @@
     }
    
     //If cfb is null ,we will try to find a right cfb to use.    
-    private Client createClientFormClientFactoryBean(ClientFactoryBean cfb) throws CamelException {
-        //TODO we can get also the client from spring context       
+    private Client createClientFormClientFactoryBean(ClientFactoryBean cfb) throws CamelException {              
         Bus bus = BusFactory.getDefaultBus();
-        // setup the ClientFactoryBean with endpoint, 
-        // we need to choice the right front end to create the clientFactoryBean
-        
-        if (null != endpoint.getServiceClass()) {
-            try {
-                Class serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass());
+        if (endpoint.isSpringContextEndpoint()) {
+            CxfEndpointBean endpointBean = endpoint.getCxfEndpointBean();
+            if (cfb == null) {
+                cfb = CxfEndpointUtils.getClientFactoryBean(endpointBean.getServiceClass());
+            }    
+            endpoint.configure(cfb);
+            // Need to set the service name and endpoint name to the ClientFactoryBean's service factory
+            // to walk around the issue of setting EndpointName and ServiceName
+            CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
+            if (cxfEndpointBean.getServiceName() != null) {
+                cfb.getServiceFactory().setServiceName(cxfEndpointBean.getServiceName());
+            } 
+            if (cxfEndpointBean.getEndpointName() != null) {
+                cfb.getServiceFactory().setEndpointName(cxfEndpointBean.getEndpointName());
+            } 
+        } else { // set up the clientFactoryBean by using URI information
+            if (null != endpoint.getServiceClass()) {
+                try {
+                    //we need to choice the right front end to create the clientFactoryBean
+                    Class serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass());
+                    if (cfb == null) {
+                        cfb = CxfEndpointUtils.getClientFactoryBean(serviceClass);
+                    } 
+                    cfb.setAddress(endpoint.getAddress());
+                    if (null != endpoint.getServiceClass()) {            
+                        cfb.setServiceClass(ObjectHelper.loadClass(endpoint.getServiceClass()));
+                    } 
+                    if (null != endpoint.getWsdlURL()) {
+                        cfb.setWsdlURL(endpoint.getWsdlURL());
+                    }                
+                } catch (ClassNotFoundException e) {
+                    throw new CamelException(e);
+                }
+            } else { // we can't see any service class from the endpoint
                 if (cfb == null) {
-                    cfb = CxfEndpointUtils.getClientFactoryBean(serviceClass);
-                } 
-                cfb.setAddress(endpoint.getAddress());
-                if (null != endpoint.getServiceClass()) {            
-                    cfb.setServiceClass(ObjectHelper.loadClass(endpoint.getServiceClass()));
-                } 
+                    cfb = new ClientFactoryBean();
+                }    
                 if (null != endpoint.getWsdlURL()) {
                     cfb.setWsdlURL(endpoint.getWsdlURL());
-                }                
-            } catch (ClassNotFoundException e) {
-                throw new CamelException(e);
+                } else {
+                    // throw the exception for insufficiency of the endpoint info
+                    throw new CamelException("Insufficiency of the endpoint info");
+                }
             }
-        } else { // we can't see any service class from the endpoint
-            if (cfb == null) {
-                cfb = new ClientFactoryBean();
+            if (endpoint.getServiceName() != null) {
+                cfb.getServiceFactory().setServiceName(CxfEndpointUtils.getServiceName(endpoint));
+            }
+            if (endpoint.getPortName() != null) {
+                cfb.getServiceFactory().setEndpointName(CxfEndpointUtils.getPortName(endpoint));
+               
             }    
-            if (null != endpoint.getWsdlURL()) {
+            if (endpoint.getWsdlURL() != null) {                
                 cfb.setWsdlURL(endpoint.getWsdlURL());
-            } else {
-                // throw the exception for insufficiency of the endpoint info
-                throw new CamelException("Insufficiency of the endpoint info");
             }
-        }
-        if (endpoint.getServiceName() != null) {
-            cfb.getServiceFactory().setServiceName(CxfEndpointUtils.getServiceName(endpoint));
-        }
-        if (endpoint.getPortName() != null) {
-            cfb.getServiceFactory().setEndpointName(CxfEndpointUtils.getPortName(endpoint));
-           
         }    
-        if (endpoint.getWsdlURL() != null) {                
-            cfb.setWsdlURL(endpoint.getWsdlURL());
-        }
         cfb.setBus(bus);        
         return cfb.create();
     }
@@ -170,8 +184,7 @@
                 Object result = cxfClient.dispatch(params, null, ex);
                 // need to get the binding object to create the message
                 BindingOperationInfo boi = ex.get(BindingOperationInfo.class);
-                Message response = null;
-                System.out.println("the boi is " + boi);
+                Message response = null;                
                 if (boi == null) {
                     // it should be the raw message                    
                     response = new MessageImpl(); 

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapConsumer.java?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapConsumer.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapConsumer.java Tue Oct  9 03:17:57 2007
@@ -67,6 +67,7 @@
         this.consumer = endpoint.getInnerEndpoint().createConsumer(soapProcessor);
         WSDLServiceFactory factory = new WSDLServiceFactory(getBus(), endpoint.getDefinition(), endpoint.getService());
         Service cxfService = factory.create();
+        // need to find with the endpoint and service Qname
         EndpointInfo ei = cxfService.getServiceInfos().iterator().next().getEndpoints().iterator().next();
         ei.setAddress("local://" + ei.getService().getName().toString() + "/" + ei.getName().getLocalPart());
         ei.getBinding().setProperty(AbstractBindingFactory.DATABINDING_DISABLED, Boolean.TRUE);

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java Tue Oct  9 03:17:57 2007
@@ -101,7 +101,7 @@
 
             if (boi == null) {
                 QName startQName = new QName(payloadEl.getNamespaceURI(), payloadEl.getLocalName());
-                System.out.println("StartQName " + startQName);
+                
                 throw new Fault(new org.apache.cxf.common.i18n.Message(
                                 "REQ_NOT_UNDERSTOOD", LOG, startQName));
             }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java Tue Oct  9 03:17:57 2007
@@ -35,8 +35,7 @@
         InputStream is = message.getContent(InputStream.class);
         OutputStream os = message.getContent(OutputStream.class);
         
-        try {
-            System.out.println("the input stream is " + is);
+        try {            
             IOUtils.copy(is, os);
             is.close();
             os.flush();

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/AbstractInvokingContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/AbstractInvokingContext.java?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/AbstractInvokingContext.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/AbstractInvokingContext.java Tue Oct  9 03:17:57 2007
@@ -125,9 +125,7 @@
     }
 
     protected <T> T getResponseObject(Message inMessage, Map<String, Object> responseContext,
-            Class <T> clazz) {
-        System.out.println("get the in message is " + inMessage);
-        System.out.println("*** responseContext is" + responseContext);
+            Class <T> clazz) {        
         T retval = null;
         if (inMessage != null) {
             if (null != responseContext) {

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/RawMessageInvokingContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/RawMessageInvokingContext.java?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/RawMessageInvokingContext.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/RawMessageInvokingContext.java Tue Oct  9 03:17:57 2007
@@ -109,15 +109,7 @@
     }
 
     public Object getResponseObject(Exchange exchange, Map<String, Object> responseContext) {
-        /*CachedOutputStream bos = exchange.getInMessage().getContent(CachedOutputStream.class);
-        InputStream in = null;
-        try {
-            in = bos.getInputStream();
-        } catch (IOException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        return in;*/
+        
         return getResponseObject(exchange.getInMessage(), responseContext, InputStream.class);
     }
     

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java Tue Oct  9 03:17:57 2007
@@ -0,0 +1,10 @@
+package org.apache.camel.component.cxf.spring;
+
+import org.apache.cxf.frontend.AbstractEndpointFactory;
+import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
+
+public class CxfEndpointBean extends AbstractEndpointFactory {    
+    public CxfEndpointBean() {
+        setServiceFactory(new ReflectionServiceFactoryBean());
+    }    
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java Tue Oct  9 03:17:57 2007
@@ -0,0 +1,98 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.camel.component.cxf.spring;
+
+import com.sun.xml.bind.v2.schemagen.xmlschema.List;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
+import org.springframework.beans.factory.BeanDefinitionStoreException;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+
+public class CxfEndpointBeanDefinitionParser extends AbstractBeanDefinitionParser {
+
+    @Override
+    protected Class getBeanClass(Element arg0) {
+        return CxfEndpointBean.class;
+    }
+    
+    @Override
+    protected void mapAttribute(BeanDefinitionBuilder bean, Element e, String name, String val) {
+        if ("endpointName".equals(name) || "serviceName".equals(name)) {
+            QName q = parseQName(e, val);
+            bean.addPropertyValue(name, q);
+        } else {
+            mapToProperty(bean, name, val);
+        }
+    }
+
+    @Override
+    protected void mapElement(ParserContext ctx, BeanDefinitionBuilder bean, Element el, String name) {
+        if ("properties".equals(name)) {
+            Map map = ctx.getDelegate().parseMapElement(el, bean.getBeanDefinition());
+            bean.addPropertyValue("properties", map);
+        } else if ("binding".equals(name)) {
+            setFirstChildAsProperty(el, ctx, bean, "bindingConfig");
+        } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
+            || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)
+            || "features".equals(name) || "schemaLocations".equals(name)) {
+            List list = (List)ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
+            bean.addPropertyValue(name, list);
+        } else {
+            setFirstChildAsProperty(el, ctx, bean, name);            
+        }        
+    }
+    
+
+    @Override
+    protected void doParse(Element element, ParserContext ctx, BeanDefinitionBuilder bean) {
+        super.doParse(element, ctx, bean);
+        bean.setLazyInit(false);
+    }
+
+    @Override
+    protected String resolveId(Element elem, 
+                               AbstractBeanDefinition definition, 
+                               ParserContext ctx) 
+        throws BeanDefinitionStoreException {
+        String id = super.resolveId(elem, definition, ctx);
+        if (StringUtils.isEmpty(id)) {
+            throw new BeanDefinitionStoreException("The bean id is needed.");
+        }
+        
+        return id;
+    }
+
+    @Override
+    protected boolean hasBusProperty() {
+        return true;
+    }
+    
+
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/NamespaceHandler.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/NamespaceHandler.java?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/NamespaceHandler.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/NamespaceHandler.java Tue Oct  9 03:17:57 2007
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.camel.component.cxf.spring;
+
+import org.apache.cxf.configuration.spring.StringBeanDefinitionParser;
+import org.apache.cxf.frontend.spring.ServerFactoryBeanDefinitionParser;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+
+public class NamespaceHandler extends NamespaceHandlerSupport {
+    public void init() {
+        registerBeanDefinitionParser("cxfEndpoint", new CxfEndpointBeanDefinitionParser());      
+        
+    }
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/NamespaceHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-cxf/src/main/resources/META-INF/spring.handlers
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/resources/META-INF/spring.handlers?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/resources/META-INF/spring.handlers (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/resources/META-INF/spring.handlers Tue Oct  9 03:17:57 2007
@@ -0,0 +1,21 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+http\://activemq.apache.org/camel/schema/cxfEndpoint=org.apache.camel.component.cxf.spring.NamespaceHandler
\ No newline at end of file

Added: activemq/camel/trunk/components/camel-cxf/src/main/resources/META-INF/spring.schemas
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/resources/META-INF/spring.schemas?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/resources/META-INF/spring.schemas (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/resources/META-INF/spring.schemas Tue Oct  9 03:17:57 2007
@@ -0,0 +1,21 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+http\://activemq.apache.org/camel/schema/cxf/cxfEndpoint.xsd=schema/cxfEndpoint.xsd
\ No newline at end of file

Added: activemq/camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd Tue Oct  9 03:17:57 2007
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<xsd:schema xmlns="http://activemq.apache.org/camel/schema/cxfEndpoint"
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+  xmlns:beans="http://www.springframework.org/schema/beans"
+  xmlns:cxf-beans="http://cxf.apache.org/configuration/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  targetNamespace="http://activemq.apache.org/camel/schema/cxfEndpoint" 
+  elementFormDefault="qualified"
+  attributeFormDefault="unqualified">
+
+  <xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd"/>
+  <xsd:import namespace="http://cxf.apache.org/configuration/beans" schemaLocation="http://cxf.apache.org/schemas/configuration/cxf-beans.xsd"/>
+    
+  <xsd:element name="cxfEndpoint">
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="beans:identifiedType">
+          <xsd:all>
+            <xsd:element name="binding" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="dataBinding" type="xsd:anyType" minOccurs="0"/>            
+            <xsd:element name="features" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="inFaultInterceptors" type="xsd:anyType" minOccurs="0"/>            
+            <xsd:element name="outInterceptors" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="outFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="properties" type="beans:mapType" minOccurs="0"/>
+            <xsd:element name="schemaLocations" type="schemasType" minOccurs="0"/>
+            <xsd:element name="serviceBean" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="serviceFactory" type="xsd:anyType" minOccurs="0"/>
+          </xsd:all>
+          <xsd:attributeGroup ref="cxf-beans:beanAttributes"/>
+          <xsd:attribute name="address" type="xsd:string" />
+          <xsd:attribute name="bindingId" type="xsd:string" />
+          <xsd:attribute name="bus" type="xsd:string" />
+          <xsd:attribute name="serviceClass" type="xsd:string"/>
+          <xsd:attribute name="transportId" type="xsd:string"/>
+          <xsd:attribute name="wsdlURL" type="xsd:string" />
+          <xsd:attribute name="endpointName" type="xsd:QName" />
+          <xsd:attribute name="serviceName" type="xsd:QName" />
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+  
+  <xsd:complexType name="schemasType">
+    <xsd:sequence>
+      <xsd:element name="schemaLocation" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+    </xsd:sequence>
+  </xsd:complexType>
+  
+</xsd:schema>

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java Tue Oct  9 03:17:57 2007
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.cxf;
+
+import java.lang.reflect.UndeclaredThrowableException;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Service;
+
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.GreeterImpl;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class CXFGreeterRouterTest extends CXFRouterSpringTest {
+    private final QName serviceName = new QName("http://apache.org/hello_world_soap_http",
+                                                "SOAPService");
+    private final QName routerPortName = new QName("http://apache.org/hello_world_soap_http",
+                                                "RouterPort");
+    
+    @Override
+    protected void startService() {
+        Object implementor = new GreeterImpl();
+        String address = "http://localhost:9000/SoapContext/SoapPort";
+        Endpoint.publish(address, implementor);
+    }
+    
+    @Override
+    public void testInvokingServiceFromCXFClient() throws Exception {
+        Service service = Service.create(serviceName);
+        service.addPort(routerPortName, "http://schemas.xmlsoap.org/soap/", 
+                        "http://localhost:9003/CamelContext/RouterPort");
+        Greeter greeter = service.getPort(routerPortName, Greeter.class);
+        
+        try {
+            
+            String reply = greeter.greetMe("test");
+            assertNotNull("No response received from service", reply);
+            assertEquals("Got the wrong reply ", "Hello test", reply);
+            reply = greeter.sayHi();
+            assertNotNull("No response received from service", reply);
+            assertEquals("Got the wrong reply ", "Bonjour", reply);
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+    
+    @Override
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/GreeterEndpointBeans.xml");
+    }
+}
+    
+
+

Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFRouterSpringTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFRouterSpringTest.java?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFRouterSpringTest.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFRouterSpringTest.java Tue Oct  9 03:17:57 2007
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.cxf;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.spring.SpringTestSupport;
+import org.apache.cxf.bus.CXFBusFactory;
+import org.apache.cxf.endpoint.ServerImpl;
+import org.apache.cxf.frontend.ServerFactoryBean;
+
+public class CXFRouterSpringTest extends CxfRouterTest {
+    protected AbstractXmlApplicationContext applicationContext;
+    
+    @Override
+    protected void setUp() throws Exception {
+        applicationContext = createApplicationContext();
+        assertNotNull("Should have created a valid spring context", applicationContext);
+
+        super.setUp();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        if (applicationContext != null) {
+            applicationContext.destroy();
+        }
+    }
+    
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                from("cxf:bean:routerEndpoint").to("cxf:bean:serviceEndpoint");              
+            }
+        };
+    }
+    
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return SpringCamelContext.springCamelContext(applicationContext);
+    }
+    
+    
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml");
+    }
+
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFRouterSpringTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java Tue Oct  9 03:17:57 2007
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.cxf;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.SpringCamelContext;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import junit.framework.TestCase;
+
+public class CxfEndpointTest extends TestCase {
+   
+    public void testSpringCxfEndpoint() throws Exception {
+        ClassPathXmlApplicationContext ctx = 
+            new ClassPathXmlApplicationContext(new String[]{"org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml"});
+        CamelContext camelContext = new SpringCamelContext(ctx);
+        CxfComponent cxfComponent = new CxfComponent(camelContext);
+        CxfEndpoint endpoint = (CxfEndpoint)cxfComponent.createEndpoint("cxf://bean:serviceEndpoint");
+        
+        assertTrue("The endpoint should be the spring context endpoint", endpoint.isSpringContextEndpoint());
+        ServerFactoryBean svf = new ServerFactoryBean();
+        endpoint.configure(svf);
+        assertEquals("Got the wrong endpoint address", svf.getAddress(), "http://localhost:9002/helloworld");
+        assertEquals("Got the wrong endpont service class", 
+            svf.getServiceClass().getCanonicalName(),
+            "org.apache.camel.component.cxf.HelloService");
+    }
+
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java Tue Oct  9 03:17:57 2007
@@ -44,8 +44,7 @@
     
     private String routerEndpointURI = "cxf://" + ROUTER_ADDRESS + "?" + SERVICE_CLASS + "&dataFormat=POJO";
     private String serviceEndpointURI = "cxf://" + SERVICE_ADDRESS + "?" + SERVICE_CLASS + "&dataFormat=POJO";
-    //private Endpoint routerEndpoint;
-    //private Endpoint resultEndpoint;
+    
     private ServerImpl server;
     
     
@@ -56,7 +55,7 @@
         startService();
     }
     
-    private void startService() {
+    protected void startService() {
         //start a service
         ServerFactoryBean svrBean = new ServerFactoryBean();
 
@@ -89,7 +88,7 @@
     }
 
     
-    public void testInvokingServerFromCXFClient() throws Exception {  
+    public void testInvokingServiceFromCXFClient() throws Exception {  
         Bus bus = BusFactory.getDefaultBus();
         
         ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
@@ -102,7 +101,6 @@
         String result = client.echo("hello world");
         assertEquals("we should get the right answer from router", "hello world", result);
         
-        //Thread.sleep(200000);
-        
+                
     }
 }

Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java Tue Oct  9 03:17:57 2007
@@ -0,0 +1,19 @@
+package org.apache.camel.component.cxf.spring;
+
+import junit.framework.TestCase;
+import org.apache.cxf.configuration.spring.ConfigurerImpl;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class CxfEndpointBeanTest extends TestCase{
+    
+    public void testCxfEndpointBeanDefinitionParser() {
+        ClassPathXmlApplicationContext ctx = 
+            new ClassPathXmlApplicationContext(new String[]{"org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml"});
+        
+        CxfEndpointBean routerEndpoint = (CxfEndpointBean)ctx.getBean("routerEndpoint");
+        assertEquals("Got the wrong endpoint address", routerEndpoint.getAddress(), "http://localhost:9000/router");
+        assertEquals("Got the wrong endpont service class", routerEndpoint.getServiceClass().getCanonicalName(), "org.apache.camel.component.cxf.HelloService");
+    }
+    
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java?rev=583092&r1=583091&r2=583092&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java Tue Oct  9 03:17:57 2007
@@ -16,6 +16,10 @@
  */
 package org.apache.camel.component.cxf.util;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.CharacterCodingException;
+
 import javax.xml.namespace.QName;
 
 import org.apache.camel.CamelContext;
@@ -23,18 +27,19 @@
 import org.apache.camel.component.cxf.CxfEndpoint;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.easymock.classextension.EasyMock;
+import sun.nio.cs.ThreadLocalCoders;
+import sun.text.Normalizer;
 import junit.framework.TestCase;
 
 public class CxfEndpointUtilsTest extends TestCase {
-    // setup the
+    // set up the port name and service name
     private static final QName SERVICE_NAME =
         new QName("http://www.example.com/test", "ServiceName");
-    //private static final QName PORT_NAME =
-    //    new QName("http://www.example.com/test", "PortName");
+   
     static final String CXF_BASE_URI = "cxf://http://www.example.com/testaddress"
         + "?serviceClass=org.apache.camel.component.cxf.HelloService"
-        + "&portName=%7bhttp://www.example.com/test%7dPortName" 
-        + "&serviceName=%7bhttp://www.example.com/test%7dServiceName";
+        + "&portName={http://www.example.com/test}PortName" 
+        + "&serviceName={http://www.example.com/test}ServiceName";
         
     
     CxfEndpoint cxfEndpoint;
@@ -50,5 +55,6 @@
         assertEquals("We should get the right service name", service, SERVICE_NAME);        
     }
     
+   
       
 }

Added: activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml Tue Oct  9 03:17:57 2007
@@ -0,0 +1,22 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:cxf="http://activemq.apache.org/camel/schema/cxfEndpoint"      
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://activemq.apache.org/camel/schema/cxfEndpoint http://activemq.apache.org/camel/schema/cxf/cxfEndpoint.xsd
+    ">
+
+  
+  <cxf:cxfEndpoint id="routerEndpoint" address="http://localhost:9003/CamelContext/RouterPort" 
+    serviceClass="org.apache.hello_world_soap_http.GreeterImpl"/>
+  
+    
+  <cxf:cxfEndpoint id="serviceEndpoint" address="http://localhost:9000/SoapContext/SoapPort" 
+    wsdlURL="testutils/hello_world.wsdl"
+    serviceClass="org.apache.hello_world_soap_http.Greeter"
+    endpointName="s:SoapPort"
+    serviceName="s:SOAPService"
+    xmlns:s="http://apache.org/hello_world_soap_http" />
+ 
+
+</beans>
\ No newline at end of file

Propchange: activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml?rev=583092&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml Tue Oct  9 03:17:57 2007
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:cxf="http://activemq.apache.org/camel/schema/cxfEndpoint"      
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://activemq.apache.org/camel/schema/cxfEndpoint http://activemq.apache.org/camel/schema/cxf/cxfEndpoint.xsd
+    ">
+
+  
+  <cxf:cxfEndpoint id="routerEndpoint" address="http://localhost:9000/router" 
+    serviceClass="org.apache.camel.component.cxf.HelloService"/>
+  
+    
+  <cxf:cxfEndpoint id="serviceEndpoint" address="http://localhost:9002/helloworld" 
+    serviceClass="org.apache.camel.component.cxf.HelloService"/>
+ 
+
+</beans>

Propchange: activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message