servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r567536 [1/4] - in /incubator/servicemix/trunk/deployables: bindingcomponents/servicemix-cxf-bc/ bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/ bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/ser...
Date Mon, 20 Aug 2007 03:37:50 GMT
Author: ffang
Date: Sun Aug 19 20:37:48 2007
New Revision: 567536

URL: http://svn.apache.org/viewvc?rev=567536&view=rev
Log:
[SM-1018] support ws-security in cxf binding component
[SM-939] more tests about ws-rm in cxf binding component

Added:
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/BusCfgSetXmlPreprocessor.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/ControlImpl.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBCRMTest.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBcRMSequenceTest.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/GreeterImpl.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/InMessageRecorder.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/MessageFlow.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/MessageLossSimulator.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/MessageRecorder.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/OutMessageRecorder.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/TwowayThread.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBCSecurityTest.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/GreeterImpl.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/KeystorePasswordCallback.java
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/atmostonce.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/decoupled.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/deferred.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/inactivity-timeout.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/message-loss-server.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/message-loss.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/no-offer.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/rminterceptors.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/seqlength1.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/seqlength10.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/sequence.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/suppressed.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/terminate-on-shutdown.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/twoway-endpoint-specific.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/rm/xbean.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/alice.jks
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/alice.properties
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/bob.jks
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/bob.properties
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/client.xml
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world.wsdl
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_base.wsdl
  (with props)
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean.xml
  (with props)
Modified:
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/pom.xml
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOperationInterceptor.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/CxfBCPolicyTest.java
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-cxf-se/pom.xml
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/pom.xml?rev=567536&r1=567535&r2=567536&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/pom.xml (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/pom.xml Sun
Aug 19 20:37:48 2007
@@ -35,9 +35,9 @@
 
   <properties>
       <jetty-version>6.1.3</jetty-version>  
-      <cxf-version>2.1-incubator-SNAPSHOT</cxf-version>
+      <cxf-version>2.0.1-incubator</cxf-version>
       <surefire.fork.mode>pertest</surefire.fork.mode>
-      
+      <derby-version>10.2.2.0</derby-version>
   </properties>
 
   <dependencies>
@@ -45,6 +45,7 @@
       <groupId>org.apache.servicemix</groupId>
       <artifactId>servicemix-shared</artifactId>
       <version>${servicemix-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.servicemix</groupId>
@@ -56,46 +57,60 @@
       <groupId>org.apache.servicemix</groupId>
       <artifactId>servicemix-services</artifactId>
       <version>${servicemix-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-frontend-jaxws</artifactId>
       <version>${cxf-version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
+      <version>1.1.1</version>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-ws-policy</artifactId>
       <version>${cxf-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-ws-addr</artifactId>
       <version>${cxf-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-ws-rm</artifactId>
       <version>${cxf-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-ws-security</artifactId>
       <version>${cxf-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-bindings-soap</artifactId>
       <version>${cxf-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-transports-http-jetty</artifactId>
       <version>${cxf-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-transports-jms</artifactId>
       <version>${cxf-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
@@ -107,27 +122,32 @@
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-transports-jbi</artifactId>
       <version>${cxf-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-bindings-jbi</artifactId>
       <version>${cxf-version}</version>
+      <scope>provided</scope>
     </dependency>
 
     <dependency>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>jetty</artifactId>
       <version>${jetty-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>jetty-sslengine</artifactId>
       <version>${jetty-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>jetty-util</artifactId>
       <version>${jetty-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
@@ -145,16 +165,19 @@
       <groupId>org.springframework</groupId>
       <artifactId>spring-support</artifactId>
       <version>${spring-version}</version>
-      </dependency>
+      <scope>provided</scope>
+    </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-aop</artifactId>
       <version>${spring-version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-jmx</artifactId>
       <version>${spring-version}</version>
+      <scope>provided</scope>
     </dependency>
 
     <dependency>
@@ -175,6 +198,12 @@
       <version>${spring-version}</version>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <version>${derby-version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
@@ -212,9 +241,17 @@
             <include>**/*Test*</include>
           </includes>
           <excludes>
-            <exclude>**/PollDirectoryTest*</exclude>
+            <exclude>**/*$*</exclude>
           </excludes>
           <forkMode>${surefire.fork.mode}</forkMode>
+          <systemProperties>
+            <property>
+              <name>derby.system.home</name>
+              <value>${basedir}/target/derby</value>
+            </property>
+                                                                                        
                        222,39        22%
+          </systemProperties>
+
         </configuration>
       </plugin>
       <plugin>

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=567536&r1=567535&r2=567536&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
Sun Aug 19 20:37:48 2007
@@ -16,8 +16,6 @@
  */
 package org.apache.servicemix.cxfbc;
 
-
-
 import java.util.List;
 import java.util.Map;
 import java.util.ResourceBundle;
@@ -57,14 +55,17 @@
 import org.apache.cxf.interceptor.StaxOutInterceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageContentsList;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.Service;
+import org.apache.cxf.service.invoker.Invoker;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.transport.ChainInitiationObserver;
+import org.apache.cxf.ws.rm.Servant;
 import org.apache.cxf.wsdl11.WSDLServiceFactory;
 import org.apache.servicemix.common.endpoints.ConsumerEndpoint;
 import org.apache.servicemix.cxfbc.interceptors.JbiInInterceptor;
@@ -75,9 +76,6 @@
 import org.apache.servicemix.soap.util.DomUtil;
 import org.springframework.core.io.Resource;
 
-
-
-
 /**
  * 
  * @author gnodet
@@ -112,7 +110,8 @@
 
     private BindingFaultInfo faultWanted;
 
-    
+    private Bus bus;
+
     /**
      * @return the wsdl
      */
@@ -162,7 +161,6 @@
 
     @Override
     public String getLocationURI() {
-        // TODO Auto-generated method stub
         return null;
     }
 
@@ -203,8 +201,14 @@
                         description);
             }
             if (service == null) {
-                service = (QName) definition.getServices().keySet().iterator()
-                        .next();
+                // looking for the servicename according to targetServiceName
+                // first
+                if (definition.getServices().containsKey(getTargetService())) {
+                    service = getTargetService();
+                } else {
+                    service = (QName) definition.getServices().keySet()
+                            .iterator().next();
+                }
             }
             WSDLServiceFactory factory = new WSDLServiceFactory(getBus(),
                     definition, service);
@@ -212,6 +216,7 @@
 
             EndpointInfo ei = cxfService.getServiceInfos().iterator().next()
                     .getEndpoints().iterator().next();
+
             if (endpoint == null) {
                 endpoint = ei.getName().getLocalPart();
             }
@@ -241,12 +246,38 @@
             cxfService.getOutFaultInterceptors().add(
                     new SoapOutInterceptor(getBus()));
             ep = new EndpointImpl(getBus(), cxfService, ei);
+            getInInterceptors().addAll(getBus().getInInterceptors());
+            getInFaultInterceptors().addAll(getBus().getInFaultInterceptors());
+            getOutInterceptors().addAll(getBus().getOutInterceptors());
+            getOutFaultInterceptors()
+                    .addAll(getBus().getOutFaultInterceptors());
+
             cxfService.getInInterceptors().addAll(getInInterceptors());
             cxfService.getInFaultInterceptors()
                     .addAll(getInFaultInterceptors());
             cxfService.getOutInterceptors().addAll(getOutInterceptors());
             cxfService.getOutFaultInterceptors().addAll(
                     getOutFaultInterceptors());
+
+            ep.getInInterceptors().addAll(getInInterceptors());
+            ep.getInFaultInterceptors().addAll(getInFaultInterceptors());
+            ep.getOutInterceptors().addAll(getOutInterceptors());
+            ep.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
+
+            ep.getOutInterceptors().add(new SoapActionOutInterceptor());
+            ep.getOutInterceptors().add(new AttachmentOutInterceptor());
+            ep.getOutInterceptors().add(new StaxOutInterceptor());
+            ep.getOutInterceptors().add(new SoapOutInterceptor(getBus()));
+
+            cxfService.getInInterceptors().addAll(getBus().getInInterceptors());
+            cxfService.getInFaultInterceptors().addAll(
+                    getBus().getInFaultInterceptors());
+            cxfService.getOutInterceptors().addAll(
+                    getBus().getOutInterceptors());
+            cxfService.getOutFaultInterceptors().addAll(
+                    getBus().getOutFaultInterceptors());
+
+            
             chain = new JbiChainInitiationObserver(ep, getBus());
             server = new ServerImpl(getBus(), ep, null, chain);
 
@@ -260,8 +291,11 @@
 
     protected Bus getBus() {
         if (getBusCfg() != null) {
-            SpringBusFactory bf = new SpringBusFactory();
-            return bf.createBus(getBusCfg());
+            if (bus == null) {
+                SpringBusFactory bf = new SpringBusFactory();
+                bus = bf.createBus(getBusCfg());
+            }
+            return bus;
         } else {
             return ((CxfBcComponent) getServiceUnit().getComponent()).getBus();
         }
@@ -289,7 +323,66 @@
             super(Phase.INVOKE);
         }
 
+        private Object getInvokee(Message message) {
+            Object invokee = message.getContent(List.class);
+            if (invokee == null) {
+                invokee = message.getContent(Object.class);
+            }
+            return invokee;
+        }
+
+        private void copyJaxwsProperties(Message inMsg, Message outMsg) {
+            outMsg.put(Message.WSDL_OPERATION, inMsg
+                    .get(Message.WSDL_OPERATION));
+            outMsg.put(Message.WSDL_SERVICE, inMsg.get(Message.WSDL_SERVICE));
+            outMsg.put(Message.WSDL_INTERFACE, inMsg
+                    .get(Message.WSDL_INTERFACE));
+            outMsg.put(Message.WSDL_PORT, inMsg.get(Message.WSDL_PORT));
+            outMsg.put(Message.WSDL_DESCRIPTION, inMsg
+                    .get(Message.WSDL_DESCRIPTION));
+        }
+
         public void handleMessage(final Message message) throws Fault {
+            final Exchange cxfExchange = message.getExchange();
+            final Endpoint endpoint = cxfExchange.get(Endpoint.class);
+            final Service service = endpoint.getService();
+            final Invoker invoker = service.getInvoker();
+
+            if (invoker instanceof Servant) {
+                // it's rm request, run the invocation directly in bc, not send
+                // to se.
+                Exchange runableEx = message.getExchange();
+                Object result = invoker.invoke(runableEx, getInvokee(message));
+                if (!cxfExchange.isOneWay()) {
+                    Endpoint end = cxfExchange.get(Endpoint.class);
+
+                    Message outMessage = runableEx.getOutMessage();
+                    if (outMessage == null) {
+                        outMessage = end.getBinding().createMessage();
+                        cxfExchange.setOutMessage(outMessage);
+                    }
+                    copyJaxwsProperties(message, outMessage);
+                    if (result != null) {
+                        MessageContentsList resList = null;
+                        if (result instanceof MessageContentsList) {
+                            resList = (MessageContentsList) result;
+                        } else if (result instanceof List) {
+                            resList = new MessageContentsList((List) result);
+                        } else if (result.getClass().isArray()) {
+                            resList = new MessageContentsList((Object[]) result);
+                        } else {
+                            outMessage.setContent(Object.class, result);
+                        }
+                        if (resList != null) {
+                            outMessage.setContent(List.class, resList);
+                        }
+                    }
+                    message.getExchange().setOutMessage(outMessage);
+                }
+
+                return;
+            }
+
             MessageExchange exchange = message
                     .getContent(MessageExchange.class);
             ComponentContext context = message.getExchange().get(
@@ -353,6 +446,7 @@
                             "out").getContent());
                 }
             }
+
         }
 
         // this method is used for ws-policy to set BindingFaultInfo
@@ -400,4 +494,5 @@
     public String getBusCfg() {
         return busCfg;
     }
+
 }

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java?rev=567536&r1=567535&r2=567536&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
Sun Aug 19 20:37:48 2007
@@ -58,7 +58,8 @@
 public class JbiInWsdl1Interceptor extends AbstractSoapInterceptor {
 
     public JbiInWsdl1Interceptor() {
-        super(Phase.UNMARSHAL);
+        //super(Phase.UNMARSHAL);
+        super(Phase.PRE_INVOKE);
         addAfter(JbiOperationInterceptor.class.getName());
     }
     
@@ -77,9 +78,6 @@
         }
         
         BindingOperationInfo wsdlOperation = getOperation(message);
-        /*if (wsdlOperation.getUnwrappedOperation() != null) {
-            wsdlOperation = wsdlOperation.getUnwrappedOperation();
-        }*/
         BindingMessageInfo wsdlMessage = !isRequestor(message) ? wsdlOperation.getInput()
: wsdlOperation.getOutput();
 
         Document document = DomUtil.createDocument();
@@ -105,6 +103,10 @@
             style = binding.getStyle();
         }
         Element body = getBodyElement(message);
+        if (body == null) {
+            //SOAP:Body is empty
+            return;
+        }
         List<SoapHeaderInfo> headers = wsdlMessage.getExtensors(SoapHeaderInfo.class);
         List<Header> headerElement = message.getHeaders();
         List<Object> parts = new ArrayList<Object>();
@@ -113,6 +115,7 @@
                 parts.add(body);
             } else /* rpc-style */ {
                 // SOAP:Body element is the operation name, children are operation parameters
+                
                 Element param = DomUtil.getFirstChildElement(body);
                 boolean found = false;
                 while (param != null) {

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOperationInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOperationInterceptor.java?rev=567536&r1=567535&r2=567536&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOperationInterceptor.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOperationInterceptor.java
Sun Aug 19 20:37:48 2007
@@ -85,6 +85,7 @@
             message.getExchange().put(BindingOperationInfo.class, operation);
             message.getExchange().put(OperationInfo.class,
                     operation.getOperationInfo());
+            message.getExchange().setOneWay(operation.getOperationInfo().isOneWay());
         }
     }
 

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java?rev=567536&r1=567535&r2=567536&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java
Sun Aug 19 20:37:48 2007
@@ -33,6 +33,7 @@
 import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.NSStack;
+import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
@@ -60,6 +61,7 @@
                 return;
             }
             Element element = new SourceTransformer().toDOMElement(source);
+            XMLUtils.printDOM(element);
             if (!JbiConstants.WSDL11_WRAPPER_NAMESPACE.equals(element
                     .getNamespaceURI())
                     || !JbiConstants.WSDL11_WRAPPER_MESSAGE_LOCALNAME

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/CxfBCPolicyTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/CxfBCPolicyTest.java?rev=567536&r1=567535&r2=567536&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/CxfBCPolicyTest.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/policy/CxfBCPolicyTest.java
Sun Aug 19 20:37:48 2007
@@ -16,8 +16,11 @@
  */
 package org.apache.servicemix.cxfbc.ws.policy;
 
+import java.net.URL;
 import java.util.logging.Logger;
 
+import javax.xml.namespace.QName;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
@@ -46,8 +49,10 @@
         LoggingOutInterceptor out = new LoggingOutInterceptor();
         bus.getOutInterceptors().add(out);
         bus.getOutFaultInterceptors().add(out);
-
-        BasicGreeterService gs = new BasicGreeterService();
+        URL wsdl = getClass().getResource("/wsdl/greeter_control.wsdl");
+        QName serviceName = new QName("http://cxf.apache.org/greeter_control",
+                                      "BasicGreeterService");
+        BasicGreeterService gs = new BasicGreeterService(wsdl, serviceName);
         final Greeter greeter = gs.getGreeterPort();
         LOG.info("Created greeter client.");
         if ("HP-UX".equals(System.getProperty("os.name"))) {

Added: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/BusCfgSetXmlPreprocessor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/BusCfgSetXmlPreprocessor.java?rev=567536&view=auto
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/BusCfgSetXmlPreprocessor.java
(added)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/BusCfgSetXmlPreprocessor.java
Sun Aug 19 20:37:48 2007
@@ -0,0 +1,49 @@
+/*
+ * 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.ws.rm;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import org.apache.xbean.spring.context.SpringApplicationContext;
+import org.apache.xbean.spring.context.SpringXmlPreprocessor;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+
+
+public class BusCfgSetXmlPreprocessor implements SpringXmlPreprocessor {
+    
+    private String busCfg;
+    
+    public BusCfgSetXmlPreprocessor(String busCfg) {
+        this.busCfg = busCfg;
+    }
+
+    public void preprocess(SpringApplicationContext applicationContext,
+            XmlBeanDefinitionReader reader, Document document) {
+        NodeList consumerList = document.getDocumentElement().getElementsByTagNameNS(
+                "http://servicemix.apache.org/cxfbc/1.0", "consumer");
+        for (int i = 0; i < consumerList.getLength(); i++) {
+            String busAttr = ((Element)consumerList.item(i)).getAttribute("busCfg");
+            if (busAttr != null && busAttr.length() > 0) {
+                ((Element)consumerList.item(i)).setAttribute("busCfg", busCfg);
+            }
+        }
+
+    }
+
+}

Propchange: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/BusCfgSetXmlPreprocessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/BusCfgSetXmlPreprocessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/ControlImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/ControlImpl.java?rev=567536&view=auto
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/ControlImpl.java
(added)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/ControlImpl.java
Sun Aug 19 20:37:48 2007
@@ -0,0 +1,165 @@
+/*
+ * 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.ws.rm;
+
+import java.util.List;
+import java.util.concurrent.Future;
+import java.util.logging.Logger;
+
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Response;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.greeter_control.FaultThrowingInterceptor;
+import org.apache.cxf.greeter_control.types.FaultLocation;
+import org.apache.cxf.greeter_control.types.StartGreeterResponse;
+import org.apache.cxf.greeter_control.types.StopGreeterResponse;
+import org.apache.cxf.interceptor.Interceptor;
+
+@WebService(serviceName = "ControlService", 
+            portName = "ControlPort", 
+            endpointInterface = "org.apache.cxf.greeter_control.Control", 
+            targetNamespace = "http://cxf.apache.org/greeter_control")
+public class ControlImpl {
+
+    private static final Logger LOG = Logger.getLogger(ControlImpl.class
+            .getName());
+
+    protected Object implementor;
+
+    protected String address;
+
+    protected Endpoint endpoint;
+
+    protected Bus greeterBus;
+
+    public void setImplementor(Object i) {
+        implementor = i;
+    }
+
+    public Object getImplementor() {
+        return implementor;
+    }
+
+    public void setAddress(String a) {
+        address = a;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public boolean startGreeter(String cfgResource) {
+        String derbyHome = System.getProperty("derby.system.home"); 
+        try {
+            System.setProperty("derby.system.home", derbyHome + "-server");   
+            /*SpringBusFactory bf = new SpringBusFactory();
+            greeterBus = bf.createBus(cfgResource);
+            BusFactory.setDefaultBus(greeterBus);
+            LOG.info("Initialised bus " + greeterBus + " with cfg file resource: " + cfgResource);
+            LOG.fine("greeterBus inInterceptors: " + greeterBus.getInInterceptors());
+
+            Interceptor logIn = new LoggingInInterceptor();
+            Interceptor logOut = new LoggingOutInterceptor();
+            greeterBus.getInInterceptors().add(logIn);
+            greeterBus.getOutInterceptors().add(logOut);
+            greeterBus.getOutFaultInterceptors().add(logOut);*/
+            if (null == getImplementor()) {
+                setImplementor(new GreeterImpl());
+            }
+            //this shouldn't happen in se
+            //Endpoint.publish(address, implementor);
+            LOG.info("Published greeter endpoint.");
+        } finally {
+            if (derbyHome != null) {
+                System.setProperty("derby.system.home", derbyHome);
+            } else {
+                System.clearProperty("derby.system.home");
+            }
+        }
+        
+        return true;        
+    }
+    
+    
+
+    public boolean stopGreeter(String requestType) {
+        LOG.fine("Stopping greeter");
+
+        if (null != endpoint) {
+            LOG.info("Stopping Greeter endpoint");
+            endpoint.stop();
+        } else {
+            LOG.info("No endpoint active.");
+        }
+        endpoint = null;
+        if (null != greeterBus) {
+            greeterBus.shutdown(true);
+        }
+        greeterBus = null;
+        return true;
+    }
+
+    public void setFaultLocation(FaultLocation fl) {
+        List<Interceptor> interceptors = greeterBus.getInInterceptors();
+        FaultThrowingInterceptor fi = null;
+        for (Interceptor i : interceptors) {
+            if (i instanceof FaultThrowingInterceptor) {
+                interceptors.remove(i);
+                LOG.fine("Removed existing FaultThrowingInterceptor");
+                break;
+            }
+        }
+
+        fi = new FaultThrowingInterceptor(fl.getPhase());
+        if (null != fl.getBefore() && !"".equals(fl.getBefore())) {
+            fi.addBefore(fl.getBefore());
+        }
+        if (null != fl.getAfter() && !"".equals(fl.getAfter())) {
+            fi.addAfter(fl.getAfter());
+        }
+
+        interceptors.add(fi);
+        LOG.fine("Added FaultThrowingInterceptor to phase " + fl.getPhase());
+    }
+
+    public Future<?> startGreeterAsync(String requestType,
+            AsyncHandler<StartGreeterResponse> asyncHandler) {
+        // never called
+        return null;
+    }
+
+    public Response<StartGreeterResponse> startGreeterAsync(String requestType) {
+        // never called
+        return null;
+    }
+
+    public Response<StopGreeterResponse> stopGreeterAsync(String requestType) {
+        // never called
+        return null;
+    }
+
+    public Future<?> stopGreeterAsync(String requestType,
+            AsyncHandler<StopGreeterResponse> asyncHandler) {
+        // never called
+        return null;
+    }
+
+  
+}

Propchange: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/ControlImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/ControlImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBCRMTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBCRMTest.java?rev=567536&view=auto
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBCRMTest.java
(added)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBCRMTest.java
Sun Aug 19 20:37:48 2007
@@ -0,0 +1,91 @@
+/*
+ * 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.ws.rm;
+
+import java.net.URL;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.GreeterService;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.servicemix.cxfbc.ws.policy.ConnectionHelper;
+import org.apache.servicemix.tck.SpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.core.io.ClassPathResource;
+
+public class CxfBCRMTest extends SpringTestSupport {
+    private static final Logger LOG = Logger.getLogger(CxfBCRMTest.class.getName());
+    private Bus bus;
+    
+    public void testDecoupled() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+        bus = bf.createBus("/org/apache/servicemix/cxfbc/ws/rm/decoupled.xml");
+        BusFactory.setDefaultBus(bus);
+        LoggingInInterceptor in = new LoggingInInterceptor();
+        bus.getInInterceptors().add(in);
+        bus.getInFaultInterceptors().add(in);
+        LoggingOutInterceptor out = new LoggingOutInterceptor();
+        bus.getOutInterceptors().add(out);
+        bus.getOutFaultInterceptors().add(out);
+        QName serviceName = new QName("http://cxf.apache.org/greeter_control", "GreeterService");
+        URL wsdl = new ClassPathResource("/wsdl/greeter_control.wsdl").getURL();
+        GreeterService gs = new GreeterService(wsdl, serviceName);
+        final Greeter greeter = gs.getGreeterPort();
+        LOG.fine("Created greeter client.");
+       
+        ConnectionHelper.setKeepAliveConnection(greeter, true);
+
+                
+        TwowayThread t = new TwowayThread(greeter);    
+        t.start();
+        
+        // allow for partial response to twoway request to arrive
+        
+        long wait = 3000;
+        while (wait > 0) {
+            long start = System.currentTimeMillis();
+            try {
+                Thread.sleep(wait);
+            } catch (InterruptedException ex) {
+                // ignore
+            }
+            wait -= System.currentTimeMillis() - start;
+        }
+
+        greeter.greetMeOneWay("oneway");
+        t.join();
+        assertEquals("Unexpected response to twoway request", "oneway", t.getResponse());
+    }
+    
+    
+    
+    @Override
+    protected AbstractXmlApplicationContext createBeanFactory() {
+        System.setProperty("derby.system.home", "/");
+        //load cxf se and bc from spring config file
+        return new ClassPathXmlApplicationContext(
+            "org/apache/servicemix/cxfbc/ws/rm/xbean.xml");    
+    }
+
+}

Propchange: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBCRMTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBCRMTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message