You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/10/31 14:53:29 UTC

svn commit: r469484 - in /incubator/servicemix/trunk/servicemix-jsr181/src: main/java/org/apache/servicemix/jsr181/Jsr181Endpoint.java main/java/org/apache/servicemix/jsr181/xfire/JbiProxy.java test/resources/org/apache/servicemix/jsr181/spring-proxy.xml

Author: gnodet
Date: Tue Oct 31 05:53:28 2006
New Revision: 469484

URL: http://svn.apache.org/viewvc?view=rev&rev=469484
Log:
SM-727: Schema import problem on jsr181

Modified:
    incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181Endpoint.java
    incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxy.java
    incubator/servicemix/trunk/servicemix-jsr181/src/test/resources/org/apache/servicemix/jsr181/spring-proxy.xml

Modified: incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181Endpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181Endpoint.java?view=diff&rev=469484&r1=469483&r2=469484
==============================================================================
--- incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181Endpoint.java (original)
+++ incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181Endpoint.java Tue Oct 31 05:53:28 2006
@@ -44,6 +44,7 @@
 import org.apache.servicemix.common.EndpointComponentContext;
 import org.apache.servicemix.common.ExchangeProcessor;
 import org.apache.servicemix.common.ManagementSupport;
+import org.apache.servicemix.common.tools.wsdl.WSDLFlattener;
 import org.apache.servicemix.jsr181.xfire.JbiFaultSerializer;
 import org.apache.servicemix.jsr181.xfire.ServiceFactoryHelper;
 import org.codehaus.xfire.XFire;
@@ -258,6 +259,7 @@
                 throw new InvalidParameterException("The name of the PortType defined by the deployed wsdl does not match the interface name of the jbi endpoint");
             }
             // Create the DOM document 
+            definition = new WSDLFlattener(definition).getDefinition(interfaceName);
             description = WSDLFactory.newInstance().newWSDLWriter().getDocument(definition);
         }
         
@@ -289,36 +291,7 @@
         // generate one
         if (this.description == null) {
             this.description = generateWsdl();
-        
-            // If the both interfaceName and serviceName are provided with non matching namespaces,
-            // the generated wsdl is bad. We have to keep only the port type definition.
-            if (this.service != null && interfaceName != null &&
-                !this.service.getNamespaceURI().equals(interfaceName.getNamespaceURI())) {
-                // Parse the WSDL
-                WSDLReader reader = WSDLFactory.newInstance().newWSDLReader(); 
-                reader.setFeature(Constants.FEATURE_VERBOSE, false);
-                definition = reader.readWSDL(null, description);
-                // Get the service and port definition
-                javax.wsdl.Service svc = definition.getService(new QName(this.interfaceName.getNamespaceURI(), this.service.getLocalPart()));
-                Port port = svc != null && svc.getPorts().size() == 1 ? (Port) svc.getPorts().values().iterator().next() : null;
-                if (port != null) {
-                    // If the endpoint name has not been defined, retrieve it now
-                    if (endpoint == null) {
-                        endpoint = port.getName();
-                    }
-                    // Now, remove binding and service infos and change target namespace
-                    definition.removeBinding(port.getBinding().getQName());
-                    definition.removeService(svc.getQName());
-                    description = WSDLFactory.newInstance().newWSDLWriter().getDocument(definition);
-                }
-            }
-            // Write WSDL
-            if (logger.isTraceEnabled()) {
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                WSDLFactory.newInstance().newWSDLWriter().writeWSDL(definition, baos);
-                logger.trace(baos.toString());
-            }
-        
+
             // Check service name and endpoint name
             QName serviceName = xfireService.getName();
             QName interfName = xfireService.getServiceInfo().getPortType();
@@ -337,7 +310,12 @@
                         ") does not match the service name defined in the endpoint spec (" + interfaceName + 
                         "). WSDL description may be unusable.");
             }
-            definition = WSDLFactory.newInstance().newWSDLReader().readWSDL(null, description);
+
+            // Parse the WSDL
+            WSDLReader reader = WSDLFactory.newInstance().newWSDLReader(); 
+            reader.setFeature(Constants.FEATURE_VERBOSE, false);
+            definition = reader.readWSDL(null, description);
+
             javax.wsdl.Service svc = definition.getService(serviceName);
             if (svc != null) {
                 if (svc.getPorts().values().size() == 1) {
@@ -355,6 +333,17 @@
             }
             if (endpoint == null) {
                 throw new IllegalArgumentException("endpoint name should be provided");
+            }
+
+            // Flatten it
+            definition = new WSDLFlattener(definition).getDefinition(interfaceName);
+            description = WSDLFactory.newInstance().newWSDLWriter().getDocument(definition);
+
+            // Write WSDL
+            if (logger.isDebugEnabled()) {
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                WSDLFactory.newInstance().newWSDLWriter().writeWSDL(definition, baos);
+                logger.debug(baos.toString());
             }
         }
     }

Modified: incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxy.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxy.java?view=diff&rev=469484&r1=469483&r2=469484
==============================================================================
--- incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxy.java (original)
+++ incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/xfire/JbiProxy.java Tue Oct 31 05:53:28 2006
@@ -88,7 +88,7 @@
             Map props = new HashMap();
             props.put(AnnotationServiceFactory.ALLOW_INTERFACE, Boolean.TRUE);
             ServiceFactory factory = ServiceFactoryHelper.findServiceFactory(xfire, serviceClass, null, null);
-            Service service = factory.create(serviceClass, null, getDescription(), props);
+            Service service = factory.create(serviceClass, props);
             JBIClient client = new JBIClient(xfire, service);
             if (interfaceName != null) {
                 client.getService().setProperty(JbiChannel.JBI_INTERFACE_NAME, interfaceName);

Modified: incubator/servicemix/trunk/servicemix-jsr181/src/test/resources/org/apache/servicemix/jsr181/spring-proxy.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jsr181/src/test/resources/org/apache/servicemix/jsr181/spring-proxy.xml?view=diff&rev=469484&r1=469483&r2=469484
==============================================================================
--- incubator/servicemix/trunk/servicemix-jsr181/src/test/resources/org/apache/servicemix/jsr181/spring-proxy.xml (original)
+++ incubator/servicemix/trunk/servicemix-jsr181/src/test/resources/org/apache/servicemix/jsr181/spring-proxy.xml Tue Oct 31 05:53:28 2006
@@ -57,11 +57,7 @@
     </property>
   </bean>
  
-  <bean id="transactionContextManager" class="org.jencks.factory.TransactionContextManagerFactoryBean"/>
-  <bean id="userTransaction" class="org.jencks.factory.GeronimoTransactionManagerFactoryBean" />
-  <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
-    <property name="userTransaction" ref="userTransaction"/>
-  </bean>
+  <bean id="transactionManager" class="org.jencks.factory.TransactionManagerFactoryBean" />
  
   <bean id="transactionTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" lazy-init="true">
     <property name="transactionManager" ref="transactionManager" />