You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2008/11/06 11:03:02 UTC
svn commit: r711825 - in
/servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse:
CxfSeEndpoint.java CxfSeProxyFactoryBean.java
Author: ffang
Date: Thu Nov 6 02:02:58 2008
New Revision: 711825
URL: http://svn.apache.org/viewvc?rev=711825&view=rev
Log:
[SM-1573]add useSOAPEnvelope flag support for both cxf-se
Modified:
servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java
servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeProxyFactoryBean.java
Modified: servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java?rev=711825&r1=711824&r2=711825&view=diff
==============================================================================
--- servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java (original)
+++ servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java Thu Nov 6 02:02:58 2008
@@ -86,6 +86,8 @@
private boolean useJBIWrapper = true;
+ private boolean useSOAPEnvelope = true;
+
/**
* Returns the object implementing the endpoint's functionality. It is
@@ -227,6 +229,7 @@
endpoint.getInInterceptors().add(new AttachmentInInterceptor());
endpoint.getOutInterceptors().add(new AttachmentOutInterceptor());
}
+
JaxWsImplementorInfo implInfo = new JaxWsImplementorInfo(getPojo()
.getClass());
setService(implInfo.getServiceName());
@@ -235,7 +238,15 @@
super.validate();
}
- /*
+ private void removeInterceptor(List<Interceptor> interceptors, String whichInterceptor) {
+ for (Interceptor interceptor : interceptors) {
+ if (interceptor.getClass().getName().endsWith(whichInterceptor)) {
+ interceptors.remove(interceptor);
+ }
+ }
+ }
+
+ /*
* (non-Javadoc)
*
* @see org.apache.servicemix.common.endpoints.ProviderEndpoint#process(javax.jbi.messaging.MessageExchange)
@@ -305,6 +316,18 @@
setService(endpoint.getServer().getEndpoint().getService().getName());
setEndpoint(endpoint.getServer().getEndpoint().getEndpointInfo()
.getName().getLocalPart());
+ if (!isUseJBIWrapper() && !isUseSOAPEnvelope()) {
+ removeInterceptor(endpoint.getServer().getEndpoint().getBinding().getInInterceptors(),
+ "ReadHeadersInterceptor");
+ removeInterceptor(endpoint.getServer().getEndpoint().getBinding().getInFaultInterceptors(),
+ "ReadHeadersInterceptor");
+ removeInterceptor(endpoint.getServer().getEndpoint().getBinding().getOutInterceptors(),
+ "SoapOutInterceptor");
+ removeInterceptor(endpoint.getServer().getEndpoint().getBinding().getOutFaultInterceptors(),
+ "SoapOutInterceptor");
+ removeInterceptor(endpoint.getServer().getEndpoint().getBinding().getOutInterceptors(),
+ "StaxOutInterceptor");
+ }
try {
definition = new ServiceWSDLBuilder(getBus(), endpoint.getServer()
.getEndpoint().getService().getServiceInfos().iterator()
@@ -387,10 +410,11 @@
/**
* Specifies if the endpoint expects messages that are encased in the
- * JBI wrapper used for SOAP messages.
+ * JBI wrapper used for SOAP messages. Ignore the value of useSOAPEnvelope
+ * if useJBIWrapper is true
*
- * @param mtomEnabled a <code>boolean</code>
- * @org.apache.xbean.Property description="Specifies if the endpoint expects to receive the JBI wrapper in the message received from the NMR. The default is <code>true</code>."
+ * @org.apache.xbean.Property description="Specifies if the endpoint expects to receive the JBI wrapper in the message received from the NMR. The default is <code>true</code>.
+ * Ignore the value of useSOAPEnvelope if useJBIWrapper is true"
* */
public void setUseJBIWrapper(boolean useJBIWrapper) {
this.useJBIWrapper = useJBIWrapper;
@@ -399,4 +423,19 @@
public boolean isUseJBIWrapper() {
return useJBIWrapper;
}
+
+ /**
+ * Specifies if the endpoint expects soap messages when useJBIWrapper is false,
+ * if useJBIWrapper is true then ignore useSOAPEnvelope
+ *
+ * @org.apache.xbean.Property description="Specifies if the endpoint expects soap messages when useJBIWrapper is false,
+ * if useJBIWrapper is true then ignore useSOAPEnvelope. The default is <code>true</code>.
+ * */
+ public void setUseSOAPEnvelope(boolean useSOAPEnvelope) {
+ this.useSOAPEnvelope = useSOAPEnvelope;
+ }
+
+ public boolean isUseSOAPEnvelope() {
+ return useSOAPEnvelope;
+ }
}
Modified: servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeProxyFactoryBean.java?rev=711825&r1=711824&r2=711825&view=diff
==============================================================================
--- servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeProxyFactoryBean.java (original)
+++ servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeProxyFactoryBean.java Thu Nov 6 02:02:58 2008
@@ -16,6 +16,8 @@
*/
package org.apache.servicemix.cxfse;
+import java.util.List;
+
import javax.jbi.component.ComponentContext;
import javax.jbi.messaging.DeliveryChannel;
import javax.naming.InitialContext;
@@ -23,6 +25,8 @@
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.transport.ConduitInitiatorManager;
import org.apache.cxf.transport.jbi.JBITransportFactory;
@@ -67,6 +71,8 @@
private ServiceMixClient client;
private boolean useJBIWrapper = true;
+
+ private boolean useSOAPEnvelope = true;
public Object getObject() throws Exception {
if (proxy == null) {
@@ -96,9 +102,30 @@
jbiTransportFactory.setDeliveryChannel(dc);
}
}
- return cf.create();
+ Object proxy = cf.create();
+ if (!isUseJBIWrapper() && !isUseSOAPEnvelope()) {
+ removeInterceptor(ClientProxy.getClient(proxy).getEndpoint().getBinding().getInInterceptors(),
+ "ReadHeadersInterceptor");
+ removeInterceptor(ClientProxy.getClient(proxy).getEndpoint().getBinding().getInFaultInterceptors(),
+ "ReadHeadersInterceptor");
+ removeInterceptor(ClientProxy.getClient(proxy).getEndpoint().getBinding().getOutInterceptors(),
+ "SoapOutInterceptor");
+ removeInterceptor(ClientProxy.getClient(proxy).getEndpoint().getBinding().getOutFaultInterceptors(),
+ "SoapOutInterceptor");
+ removeInterceptor(ClientProxy.getClient(proxy).getEndpoint().getBinding().getOutInterceptors(),
+ "StaxOutInterceptor");
+ }
+ return proxy;
}
+ private void removeInterceptor(List<Interceptor> interceptors, String whichInterceptor) {
+ for (Interceptor interceptor : interceptors) {
+ if (interceptor.getClass().getName().endsWith(whichInterceptor)) {
+ interceptors.remove(interceptor);
+ }
+ }
+ }
+
public Class getObjectType() {
return type;
}
@@ -242,6 +269,14 @@
}
}
+ /**
+ * Specifies if the endpoint expects messages that are encased in the
+ * JBI wrapper used for SOAP messages. Ignore the value of useSOAPEnvelope
+ * if useJBIWrapper is true
+ *
+ * @org.apache.xbean.Property description="Specifies if the endpoint expects to receive the JBI wrapper in the message received from the NMR. The default is <code>true</code>.
+ * Ignore the value of useSOAPEnvelope if useJBIWrapper is true"
+ * */
public void setUseJBIWrapper(boolean useJBIWrapper) {
this.useJBIWrapper = useJBIWrapper;
}
@@ -249,5 +284,20 @@
public boolean isUseJBIWrapper() {
return useJBIWrapper;
}
+
+ /**
+ * Specifies if the endpoint expects soap messages when useJBIWrapper is false,
+ * if useJBIWrapper is true then ignore useSOAPEnvelope
+ *
+ * @org.apache.xbean.Property description="Specifies if the endpoint expects soap messages when useJBIWrapper is false,
+ * if useJBIWrapper is true then ignore useSOAPEnvelope. The default is <code>true</code>.
+ * */
+ public void setUseSOAPEnvelope(boolean useSOAPEnvelope) {
+ this.useSOAPEnvelope = useSOAPEnvelope;
+ }
+
+ public boolean isUseSOAPEnvelope() {
+ return useSOAPEnvelope;
+ }
}