You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2011/09/22 08:11:36 UTC
svn commit: r1173958 - in /camel/trunk/components/camel-cxf/src:
main/java/org/apache/camel/component/cxf/ main/resources/schema/
test/java/org/apache/camel/component/cxf/spring/
test/resources/org/apache/camel/component/cxf/spring/
Author: ningjiang
Date: Thu Sep 22 06:11:35 2011
New Revision: 1173958
URL: http://svn.apache.org/viewvc?rev=1173958&view=rev
Log:
CAMEL-4473 Fixed the issue of cxf:bing configuration
Modified:
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=1173958&r1=1173957&r2=1173958&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Thu Sep 22 06:11:35 2011
@@ -49,10 +49,12 @@ import org.apache.camel.util.UnsafeUriCh
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
+import org.apache.cxf.binding.BindingConfiguration;
import org.apache.cxf.common.classloader.ClassLoaderUtils;
import org.apache.cxf.common.injection.ResourceInjector;
import org.apache.cxf.common.util.ClassHelper;
import org.apache.cxf.common.util.ModCountCopyOnWriteArrayList;
+import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.ClientImpl;
import org.apache.cxf.endpoint.Endpoint;
@@ -74,6 +76,7 @@ import org.apache.cxf.message.MessageCon
import org.apache.cxf.resource.DefaultResourceManager;
import org.apache.cxf.resource.ResourceManager;
import org.apache.cxf.resource.ResourceResolver;
+import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.apache.cxf.service.model.MessagePartInfo;
import org.slf4j.Logger;
@@ -130,7 +133,10 @@ public class CxfEndpoint extends Default
private List<String> schemaLocations;
private String transportId;
private String bindingId;
-
+
+ private BindingConfiguration bindingConfig;
+ private DataBinding dataBinding;
+ private ReflectionServiceFactoryBean serviceFactoryBean;
public CxfEndpoint(String remaining, CxfComponent cxfComponent) {
@@ -193,6 +199,17 @@ public class CxfEndpoint extends Default
if (schemaLocations != null) {
sfb.setSchemaLocations(schemaLocations);
}
+ if (bindingConfig != null) {
+ sfb.setBindingConfig(bindingConfig);
+ }
+
+ if (dataBinding != null) {
+ sfb.setDataBinding(dataBinding);
+ }
+
+ if (serviceFactoryBean != null) {
+ sfb.setServiceFactory(serviceFactoryBean);
+ }
if (sfb instanceof JaxWsServerFactoryBean && handlers != null) {
((JaxWsServerFactoryBean)sfb).setHandlers(handlers);
@@ -342,6 +359,18 @@ public class CxfEndpoint extends Default
factoryBean.setFeatures(features);
factoryBean.setTransportId(transportId);
factoryBean.setBindingId(bindingId);
+
+ if (bindingConfig != null) {
+ factoryBean.setBindingConfig(bindingConfig);
+ }
+
+ if (dataBinding != null) {
+ factoryBean.setDataBinding(dataBinding);
+ }
+
+ if (serviceFactoryBean != null) {
+ factoryBean.setServiceFactory(serviceFactoryBean);
+ }
// address
factoryBean.setAddress(getAddress());
@@ -861,4 +890,29 @@ public class CxfEndpoint extends Default
this.bindingId = bindingId;
}
+ public BindingConfiguration getBindingConfig() {
+ return bindingConfig;
+ }
+
+ public void setBindingConfig(BindingConfiguration bindingConfig) {
+ this.bindingConfig = bindingConfig;
+ }
+
+ public DataBinding getDataBinding() {
+ return dataBinding;
+ }
+
+ public void setDataBinding(DataBinding dataBinding) {
+ this.dataBinding = dataBinding;
+ }
+
+ public ReflectionServiceFactoryBean getServiceFactoryBean() {
+ return serviceFactoryBean;
+ }
+
+ public void setServiceFactoryBean(ReflectionServiceFactoryBean serviceFactoryBean) {
+ this.serviceFactoryBean = serviceFactoryBean;
+ }
+
+
}
Modified: camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd?rev=1173958&r1=1173957&r2=1173958&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd (original)
+++ camel/trunk/components/camel-cxf/src/main/resources/schema/cxfEndpoint.xsd Thu Sep 22 06:11:35 2011
@@ -44,7 +44,6 @@
<xsd:element name="handlers" 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"/>
Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java?rev=1173958&r1=1173957&r2=1173958&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java (original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java Thu Sep 22 06:11:35 2011
@@ -20,6 +20,7 @@ import javax.xml.namespace.QName;
import org.apache.camel.component.cxf.CXFTestSupport;
import org.apache.camel.component.cxf.CxfEndpoint;
+import org.apache.cxf.binding.soap.SoapBindingConfiguration;
import org.junit.Test;
public class CxfEndpointBeanTest extends AbstractSpringBeanTestSupport {
@@ -53,6 +54,10 @@ public class CxfEndpointBeanTest extends
CxfEndpoint myEndpoint = (CxfEndpoint)ctx.getBean("myEndpoint");
assertEquals("Got the wrong endpointName", endpointName, myEndpoint.getPortName());
assertEquals("Got the wrong serviceName", serviceName, myEndpoint.getServiceName());
+ assertTrue("We should get a soap binding", myEndpoint.getBindingConfig() instanceof SoapBindingConfiguration);
+ SoapBindingConfiguration configuration = (SoapBindingConfiguration)myEndpoint.getBindingConfig();
+ assertEquals("We should get a right soap version", "1.2", String.valueOf(configuration.getVersion().getVersion()));
+
}
Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml?rev=1173958&r1=1173957&r2=1173958&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml (original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml Thu Sep 22 06:11:35 2011
@@ -18,8 +18,10 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:soap="http://cxf.apache.org/bindings/soap"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
@@ -40,9 +42,13 @@
<cxf:cxfEndpoint id="serviceEndpoint" address="http://localhost:${CXFTestSupport.port2}/CxfEndpointBeanTest/helloworld"
serviceClass="org.apache.camel.component.cxf.HelloService"/>
- <cxf:cxfEndpoint id="myEndpoint" address="http://localhot:${CXFTestSupport.port3}/test"
+ <cxf:cxfEndpoint id="myEndpoint" address="http://localhost:${CXFTestSupport.port3}/test"
serviceClass="org.apache.camel.wsdl_first.Person" serviceName="${CxfEndpointBeans.serviceName}" endpointName="${CxfEndpointBeans.endpointName}"
- wsdlURL="person.wsdl"/>
+ wsdlURL="person.wsdl">
+ <cxf:binding>
+ <soap:soapBinding version="1.2"/>
+ </cxf:binding>
+ </cxf:cxfEndpoint>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>