cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r528404 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ rt/frontend/simple/src/...
Date Fri, 13 Apr 2007 09:31:33 GMT
Author: mmao
Date: Fri Apr 13 02:31:32 2007
New Revision: 528404

URL: http://svn.apache.org/viewvc?view=rev&rev=528404
Log:
CXF-522
* ServiceConfiguration/ServiceFactory can getStyle
* ServiceFactoryBean support RPC style
* Javato Tools can generate wsdl with RPC style
* Use the url as the wsdlto tools plugin key instead of url.getFile(), which not working in
eclipse.
* FrontEndGenerator add a getName() interface.
* If there is no wsdl location input in wsdlto tools, throw exceptions

Added:
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl
Modified:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/FrontEndGenerator.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLNoAnnoTest.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java
    incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/Messages.properties
    incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/PluginLoader.java

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?view=diff&rev=528404&r1=528403&r2=528404
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
Fri Apr 13 02:31:32 2007
@@ -470,5 +470,14 @@
             return webResult != null && webResult.header();
         }
     }
+
+    @Override
+    public String getStyle() {
+        SOAPBinding ann = implInfo.getEndpointClass().getAnnotation(SOAPBinding.class);
+        if (ann != null) {
+            return ann.style().toString().toLowerCase();
+        }
+        return "document";
+    }
     
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java?view=diff&rev=528404&r1=528403&r2=528404
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
Fri Apr 13 02:31:32 2007
@@ -73,6 +73,47 @@
         assertEquals("get wrong in partName for first param", new QName("http://cxf.com/",
"arg1"), partName);
     }
 
+    public void testDefaultStyle() throws Exception {
+        JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
+        bean.setServiceClass(Hello.class);
+        JaxWsServiceConfiguration jwsc = (JaxWsServiceConfiguration) bean.getServiceConfigurations().get(0);
+        jwsc.setServiceFactory(bean);
+
+        // REVIST: the Hello.class,  is not a valide JAXWS SEI, the Style.RPC can not on
method (JSR-181)
+        assertEquals("document", jwsc.getStyle());
+        assertNull(jwsc.isWrapped());
+    }
+
+    public void testRPCStyle() throws Exception {
+        JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
+        bean.setServiceClass(HelloRPC.class);
+        JaxWsServiceConfiguration jwsc = (JaxWsServiceConfiguration) bean.getServiceConfigurations().get(0);
+        jwsc.setServiceFactory(bean);
+        
+        assertEquals("rpc", jwsc.getStyle());
+        assertFalse(jwsc.isWrapped());
+    }
+
+    public void testDocumentWrappedStyle() throws Exception {
+        JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
+        bean.setServiceClass(HelloWrapped.class);
+        JaxWsServiceConfiguration jwsc = (JaxWsServiceConfiguration) bean.getServiceConfigurations().get(0);
+        jwsc.setServiceFactory(bean);
+        
+        assertEquals("document", jwsc.getStyle());
+        assertTrue(jwsc.isWrapped());
+    }
+
+    public void testDocumentBareStyle() throws Exception {
+        JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
+        bean.setServiceClass(HelloBare.class);
+        JaxWsServiceConfiguration jwsc = (JaxWsServiceConfiguration) bean.getServiceConfigurations().get(0);
+        jwsc.setServiceFactory(bean);
+        
+        assertEquals("document", jwsc.getStyle());
+        assertFalse(jwsc.isWrapped());
+    }
+
     public void testGetOutPartName() throws Exception {
         QName opName = new QName("http://cxf.com/", "sayHi");
         Method sayHiMethod = Hello.class.getMethod("sayHi", new Class[]{});
@@ -120,6 +161,7 @@
         return serviceInfo;
     }
 
+    // REVISIT this is not a valid JAXWS SEI Style.RPC can not put on method. (JSR-181)
     @WebService(name = "Hello", targetNamespace = "http://cxf.com/")
     public interface Hello {
         @SOAPBinding(parameterStyle = javax.jws.soap.SOAPBinding.ParameterStyle.BARE, 
@@ -133,4 +175,19 @@
         String sayHello(String asdf1, String asdf2);
     }
 
+    @SOAPBinding(style = javax.jws.soap.SOAPBinding.Style.RPC)
+    public interface HelloRPC {
+        String sayHi();
+    }
+
+    @SOAPBinding(style = javax.jws.soap.SOAPBinding.Style.DOCUMENT)
+    public interface HelloWrapped {
+        String sayHi();
+    }
+
+    @SOAPBinding(parameterStyle = javax.jws.soap.SOAPBinding.ParameterStyle.BARE,
+                 style = javax.jws.soap.SOAPBinding.Style.DOCUMENT)
+    public interface HelloBare {
+        String sayHi();
+    }
 }

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java?view=diff&rev=528404&r1=528403&r2=528404
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
Fri Apr 13 02:31:32 2007
@@ -22,7 +22,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
-
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
@@ -30,6 +29,7 @@
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.BindingConfiguration;
 import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.binding.soap.SoapBindingConfiguration;
 import org.apache.cxf.binding.soap.model.SoapBindingInfo;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
@@ -76,7 +76,6 @@
         if (endpointName == null) {
             endpointName = serviceFactory.getEndpointName();
         }
-        
         EndpointInfo ei = service.getEndpointInfo(endpointName);
         if (ei != null
             && transportId != null
@@ -93,7 +92,7 @@
             }
         } else if (getAddress() != null) {
             ei.setAddress(getAddress()); 
-        }                        
+        }
 
         Endpoint ep = service.getEndpoints().get(ei.getName());
         
@@ -217,6 +216,12 @@
         }
         
         try {
+            if ("http://schemas.xmlsoap.org/soap/".equals(binding)) {
+                if (bindingConfig == null) {
+                    bindingConfig = new SoapBindingConfiguration();
+                }
+                ((SoapBindingConfiguration)bindingConfig).setStyle(serviceFactory.getStyle());
+            }
             return mgr.getBindingFactory(binding).createBindingInfo(serviceFactory.getService(),
                                                                     binding, bindingConfig);
         } catch (BusException ex) {
@@ -334,4 +339,4 @@
         getServiceFactory().setWsdlURL(wsdlURL);
     }
     
-}
\ No newline at end of file
+}

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java?view=diff&rev=528404&r1=528403&r2=528404
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
Fri Apr 13 02:31:32 2007
@@ -53,6 +53,10 @@
         return null;
     }
 
+    public String getStyle() {
+        return null;
+    }
+
     public Boolean isWrapped() {
         return null;
     }

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?view=diff&rev=528404&r1=528403&r2=528404
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Fri Apr 13 02:31:32 2007
@@ -964,6 +964,16 @@
         return true;
     }
 
+    public String getStyle() {
+        for (AbstractServiceConfiguration c : serviceConfigurations) {
+            String style = c.getStyle();
+            if (style != null) {
+                return style;
+            }
+        }
+        return "document";
+    }
+
     public void setWrapped(boolean style) {
         this.wrappedStyle = style;
     }

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/FrontEndGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/FrontEndGenerator.java?view=diff&rev=528404&r1=528403&r2=528404
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/FrontEndGenerator.java
(original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/FrontEndGenerator.java
Fri Apr 13 02:31:32 2007
@@ -19,13 +19,8 @@
 
 package org.apache.cxf.tools.common;
 
-/**
- * Interface for code generators used by the tools
- *
- * @author codea
- */
 public interface FrontEndGenerator {
-
+    String getName();
     void generate(ToolContext penv);
 }
 

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLNoAnnoTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLNoAnnoTest.java?view=diff&rev=528404&r1=528403&r2=528404
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLNoAnnoTest.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLNoAnnoTest.java
Fri Apr 13 02:31:32 2007
@@ -39,7 +39,7 @@
     
     @After
     public void tearDown() {
-        super.tearDown();
+        //super.tearDown();
         j2wProcessor = null;
     }
 

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java?view=diff&rev=528404&r1=528403&r2=528404
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java
Fri Apr 13 02:31:32 2007
@@ -39,6 +39,10 @@
         builder.setBus(BusFactory.getDefaultBus());
     }
 
+//     @org.junit.After
+//     public void tearDown() {
+//     }
+
     // Revisit:
     // * Missing wsdl:types
     // * getPrice MUST refeter to schema element
@@ -56,6 +60,7 @@
         assertTrue(output.exists());
     }
 
+
     // Passed
     @Test
     public void testGeneratedWithDocWrappedClass() throws Exception {
@@ -72,7 +77,7 @@
 
     // Revisit:
     // * Missing wsdl:types
-    // * Binding style should be RPC not Document
+    // * Binding style should be RPC not Document (FIXED)
     // * input message of binding operation "getPrice" MUST specify a value for the "namespace"
attribute
     // * output message of binding operation "getPrice" MUST specify a value for the "namespace"
attribute
     // CXF-522
@@ -84,6 +89,9 @@
         File output = getOutputFile("stock_noanno_rpc.wsdl");
         generator.generate(output);
         assertTrue(output.exists());
+
+        String expectedFile = getClass().getResource("expected/stock_noanno_rpc.wsdl").getFile();
+        assertFileEquals(expectedFile, output.getAbsolutePath());
     }
 
     private File getOutputFile(String fileName) {

Added: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl?view=auto&rev=528404
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl
(added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_rpc.wsdl
Fri Apr 13 02:31:32 2007
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="StockService" targetNamespace="http://rpc.classnoanno.fortest.tools.cxf.apache.org/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://rpc.classnoanno.fortest.tools.cxf.apache.org/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+  <wsdl:message name="getPrice">
+    <wsdl:part name="arg0" type="xsd:string">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="getPriceResponse">
+    <wsdl:part name="return" type="xsd:float">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="Stock">
+    <wsdl:operation name="getPrice">
+      <wsdl:input name="getPrice" message="ns1:getPrice">
+    </wsdl:input>
+      <wsdl:output name="getPriceResponse" message="ns1:getPriceResponse">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="StockServiceSoapBinding" type="ns1:Stock">
+    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="getPrice">
+      <wsdlsoap:operation soapAction="" style="rpc"/>
+      <wsdl:input name="getPrice">
+        <wsdlsoap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="getPriceResponse">
+        <wsdlsoap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="StockService">
+    <wsdl:port name="StockPort" binding="ns1:StockServiceSoapBinding">
+      <wsdlsoap:address/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>

Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/Messages.properties?view=diff&rev=528404&r1=528403&r2=528404
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/Messages.properties
(original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/Messages.properties
Fri Apr 13 02:31:32 2007
@@ -28,4 +28,6 @@
 
 
 FOUND_NO_DATABINDING = Can not find databinding
-FOUND_NO_FRONTEND = Can not find frontend
\ No newline at end of file
+FOUND_NO_FRONTEND = Can not find frontend
+
+NO_WSDL_URL = WSDL URL can not be null
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?view=diff&rev=528404&r1=528403&r2=528404
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
Fri Apr 13 02:31:32 2007
@@ -40,6 +40,7 @@
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.service.model.InterfaceInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.AbstractCXFToolContainer;
@@ -324,6 +325,11 @@
         }
 
         String wsdl = (String)env.get(ToolConstants.CFG_WSDLURL);
+        if (StringUtils.isEmpty(wsdl)) {
+            Message msg = new Message("NO_WSDL_URL", LOG);
+            throw new ToolException(msg);
+        }
+
         env.put(ToolConstants.CFG_WSDLURL, URIParserUtil.normalize(wsdl));
 
         String[] bindingFiles;

Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/PluginLoader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/PluginLoader.java?view=diff&rev=528404&r1=528403&r2=528404
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/PluginLoader.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/PluginLoader.java
Fri Apr 13 02:31:32 2007
@@ -180,7 +180,7 @@
 
     protected Collection<Plugin> getPlugins(URL url) 
         throws IOException, JAXBException, FileNotFoundException {
-        Collection<Plugin> p = plugins.get(url.getFile());
+        Collection<Plugin> p = plugins.get(url.toString());
         InputStream is = null;
         if (p == null) {
             is = url.openStream();
@@ -190,10 +190,10 @@
                 LOG.log(Level.SEVERE, msg.toString());
                 throw new ToolException(msg);
             }
-            plugins.put(url.getFile(), p);
+            plugins.put(url.toString(), p);
         }        
         if (is == null) {
-            return getPlugins(url.getFile());
+            return getPlugins(url);
         }
         return p;
     }



Mime
View raw message