servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r800839 - in /servicemix/components/bindings/servicemix-rmi/trunk: pom.xml src/main/java/org/apache/servicemix/rmi/RmiConsumerEndpoint.java src/test/java/org/apache/servicemix/rmi/RmiXBeanTest.java
Date Tue, 04 Aug 2009 15:11:47 GMT
Author: jbonofre
Date: Tue Aug  4 15:11:46 2009
New Revision: 800839

URL: http://svn.apache.org/viewvc?rev=800839&view=rev
Log:
Add WSDL generation based on the provided remote interface.

Modified:
    servicemix/components/bindings/servicemix-rmi/trunk/pom.xml
    servicemix/components/bindings/servicemix-rmi/trunk/src/main/java/org/apache/servicemix/rmi/RmiConsumerEndpoint.java
    servicemix/components/bindings/servicemix-rmi/trunk/src/test/java/org/apache/servicemix/rmi/RmiXBeanTest.java

Modified: servicemix/components/bindings/servicemix-rmi/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-rmi/trunk/pom.xml?rev=800839&r1=800838&r2=800839&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-rmi/trunk/pom.xml (original)
+++ servicemix/components/bindings/servicemix-rmi/trunk/pom.xml Tue Aug  4 15:11:46 2009
@@ -41,6 +41,7 @@
     <properties>
         <servicemix-version>3.3.1-SNAPSHOT</servicemix-version>
         <servicemix-shared-version>2009.01</servicemix-shared-version>
+        <cxf-version>2.2.3-SNAPSHOT</cxf-version>
         
         <servicemix.osgi.import>
             org.apache.servicemix;resolution:=optional,
@@ -80,6 +81,21 @@
             <version>${servicemix-shared-version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-simple</artifactId>
+            <version>${cxf-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-core</artifactId>
+            <version>${cxf-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-databinding-aegis</artifactId>
+            <version>${cxf-version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.apache.servicemix.specs</groupId>
             <artifactId>org.apache.servicemix.specs.jbi-api-1.0</artifactId>
             <scope>provided</scope>

Modified: servicemix/components/bindings/servicemix-rmi/trunk/src/main/java/org/apache/servicemix/rmi/RmiConsumerEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-rmi/trunk/src/main/java/org/apache/servicemix/rmi/RmiConsumerEndpoint.java?rev=800839&r1=800838&r2=800839&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-rmi/trunk/src/main/java/org/apache/servicemix/rmi/RmiConsumerEndpoint.java
(original)
+++ servicemix/components/bindings/servicemix-rmi/trunk/src/main/java/org/apache/servicemix/rmi/RmiConsumerEndpoint.java
Tue Aug  4 15:11:46 2009
@@ -30,7 +30,14 @@
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLWriter;
 
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.simple.SimpleServiceBuilder;
+import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
 import org.apache.servicemix.common.endpoints.ConsumerEndpoint;
 import org.apache.servicemix.rmi.marshaler.DefaultRmiMarshaler;
 import org.apache.servicemix.rmi.marshaler.RmiCall;
@@ -147,7 +154,23 @@
             logger.debug("The user hasn't define the registry name, use the endpoint one.");
             name = this.getEndpoint();
         }
-        
+
+        // use CXF to generate the WSDL definition
+        SimpleServiceBuilder serviceBuilder = new SimpleServiceBuilder();
+        serviceBuilder.setServiceClass(remoteInterface);
+        serviceBuilder.setDataBinding(new AegisDatabinding());
+        ServiceInfo serviceInfo = serviceBuilder.createService();
+        ServiceWSDLBuilder wsdlBuilder = new ServiceWSDLBuilder(BusFactory.getDefaultBus(),
serviceInfo);
+        try {
+            definition = wsdlBuilder.build();
+            // TODO cleanup the definition (add correct name/target namespace) and make cleanup
(binding) to make an abstract WSDL
+            // use wsdl4j to create the WSDL description
+            WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
+            description = writer.getDocument(definition);
+        } catch (Exception e) {
+            logger.error("Can't generate the endpoint WSDL.", e);
+            throw new DeploymentException("Can't generate the endpoint WSDL.", e);
+        }
     }
     
     /*
@@ -163,7 +186,7 @@
         
         // create the dynamic proxy
         Class[] interfaceArray = new Class[]{ remoteInterface };
-        proxy = (Remote) Proxy.newProxyInstance(this.getClass().getClassLoader(), interfaceArray,
this);
+        proxy = (Remote) Proxy.newProxyInstance(remoteInterface.getClassLoader(), interfaceArray,
this);
         // create the remote stub
         stub = UnicastRemoteObject.exportObject(proxy, 0);
         try {

Modified: servicemix/components/bindings/servicemix-rmi/trunk/src/test/java/org/apache/servicemix/rmi/RmiXBeanTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-rmi/trunk/src/test/java/org/apache/servicemix/rmi/RmiXBeanTest.java?rev=800839&r1=800838&r2=800839&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-rmi/trunk/src/test/java/org/apache/servicemix/rmi/RmiXBeanTest.java
(original)
+++ servicemix/components/bindings/servicemix-rmi/trunk/src/test/java/org/apache/servicemix/rmi/RmiXBeanTest.java
Tue Aug  4 15:11:46 2009
@@ -19,16 +19,11 @@
 import java.io.File;
 import java.rmi.registry.LocateRegistry;
 
-import javax.jbi.servicedesc.ServiceEndpoint;
-import javax.management.ObjectName;
-import javax.xml.namespace.QName;
-
 import junit.framework.TestCase;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.jbi.container.JBIContainer;
-import org.apache.servicemix.jbi.framework.Registry;
 import org.springframework.core.io.ClassPathResource;
 
 /**



Mime
View raw message