servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1133017 - in /servicemix/components/trunk/bindings/servicemix-cxf-bc/src: main/java/org/apache/servicemix/cxfbc/ main/java/org/apache/servicemix/cxfbc/interceptors/ test/java/org/apache/servicemix/cxfbc/
Date Tue, 07 Jun 2011 14:06:29 GMT
Author: ffang
Date: Tue Jun  7 14:06:28 2011
New Revision: 1133017

URL: http://svn.apache.org/viewvc?rev=1133017&view=rev
Log:
[SMXCOMP-833]cxf bc consumer should be able to determine soap version from incoming message

Added:
    servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/SetSoapVersionInterceptor.java
Modified:
    servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
    servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderConsumerTest.java

Modified: servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=1133017&r1=1133016&r2=1133017&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
(original)
+++ servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
Tue Jun  7 14:06:28 2011
@@ -115,6 +115,7 @@ import org.apache.servicemix.cxfbc.inter
 import org.apache.servicemix.cxfbc.interceptors.JbiFault;
 import org.apache.servicemix.cxfbc.interceptors.SchemaValidationInInterceptor;
 import org.apache.servicemix.cxfbc.interceptors.SchemaValidationOutInterceptor;
+import org.apache.servicemix.cxfbc.interceptors.SetSoapVersionInterceptor;
 import org.apache.servicemix.cxfbc.interceptors.SetStatusInterceptor;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.soap.util.DomUtil;
@@ -506,6 +507,8 @@ public class CxfBcConsumer extends Consu
             cxfService.getOutInterceptors().add(
                     new ExtractHeaderPartIntercepor());
             cxfService.getOutInterceptors().add(
+                    new SetSoapVersionInterceptor());
+            cxfService.getOutInterceptors().add(
                     new SetStatusInterceptor());
 
             cxfService.getOutInterceptors().add(new AttachmentOutInterceptor());

Added: servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/SetSoapVersionInterceptor.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/SetSoapVersionInterceptor.java?rev=1133017&view=auto
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/SetSoapVersionInterceptor.java
(added)
+++ servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/SetSoapVersionInterceptor.java
Tue Jun  7 14:06:28 2011
@@ -0,0 +1,39 @@
+/*
+ * 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.servicemix.cxfbc.interceptors;
+
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.phase.Phase;
+
+public class SetSoapVersionInterceptor extends AbstractSoapInterceptor {
+
+    public SetSoapVersionInterceptor() {
+        super(Phase.WRITE);
+        addBefore(SoapOutInterceptor.class.getName());
+    }
+    public void handleMessage(SoapMessage message) throws Fault {
+        if (message.getExchange() != null) { 
+            if (message.getExchange().getInMessage() instanceof SoapMessage) {
+                ((SoapMessage)message).setVersion(((SoapMessage)message.getExchange().getInMessage()).getVersion());
+            } 
+        }
+    }
+
+}

Modified: servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderConsumerTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderConsumerTest.java?rev=1133017&r1=1133016&r2=1133017&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderConsumerTest.java
(original)
+++ servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderConsumerTest.java
Tue Jun  7 14:06:28 2011
@@ -20,6 +20,7 @@ import java.net.URL;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
 import javax.xml.ws.soap.SOAPBinding;
 import org.apache.cxf.calculator.CalculatorImpl;
 import org.apache.cxf.calculator.CalculatorPortType;
@@ -34,6 +35,7 @@ import org.springframework.context.suppo
 
 public class CxfBcProviderConsumerTest extends CxfBcSpringTestSupport {
 
+    
     public void testBridge() throws Exception {
         
         URL wsdl = getClass().getResource("/wsdl/calculator.wsdl");
@@ -50,12 +52,13 @@ public class CxfBcProviderConsumerTest e
         // start external client
         
         assertNotNull(wsdl);
-        CalculatorService service1 = new CalculatorService(wsdl, new QName(
+        Service service1 = Service.create(new QName(
                 "http://apache.org/cxf/calculator", "CalculatorService"));
         QName endpointName = new QName("http://apache.org/cxf/calculator", "CalculatorPort");
         service1.addPort(endpointName, 
-                SOAPBinding.SOAP12HTTP_BINDING, "http://localhost:19000/CalculatorService/SoapPort");
+                SOAPBinding.SOAP11HTTP_BINDING, "http://localhost:19000/CalculatorService/SoapPort");
         CalculatorPortType port = service1.getPort(endpointName, CalculatorPortType.class);
+        
         ClientProxy.getClient(port).getInFaultInterceptors().add(new LoggingInInterceptor());
         ClientProxy.getClient(port).getInInterceptors().add(new LoggingInInterceptor());
         ClientProxy.getClient(port).getOutFaultInterceptors().add(new LoggingOutInterceptor());
@@ -74,6 +77,7 @@ public class CxfBcProviderConsumerTest e
 
     }
 
+
     @Override
     protected AbstractXmlApplicationContext createBeanFactory() {
         return new ClassPathXmlApplicationContext(



Mime
View raw message