cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r570596 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ systests/src/test/java/org/apache/cxf/systest/jaxws/
Date Wed, 29 Aug 2007 00:14:34 GMT
Author: dkulp
Date: Tue Aug 28 17:14:32 2007
New Revision: 570596

URL: http://svn.apache.org/viewvc?rev=570596&view=rev
Log:
[CXF-874] Warn about issues of using Proxies for services.   Use a default namespace to avoid
wsdl creation problems.

Added:
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
      - copied, changed from r570457, incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
Removed:
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
Modified:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java?rev=570596&r1=570595&r2=570596&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
Tue Aug 28 17:14:32 2007
@@ -225,7 +225,7 @@
     private String getDefaultNamespace(Class clazz) {
         Package pkg = clazz.getPackage();
         if (pkg == null) {
-            return null;
+            return "http://unknown.namespace/";
         } else {
             return PackageUtils.getNamespace(pkg.getName());
         }

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?rev=570596&r1=570595&r2=570596&view=diff
==============================================================================
--- 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
Tue Aug 28 17:14:32 2007
@@ -24,6 +24,7 @@
 import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Proxy;
 import java.lang.reflect.Type;
 import java.net.URL;
 import java.util.ArrayList;
@@ -33,8 +34,8 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.ResourceBundle;
 import java.util.concurrent.Executor;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
@@ -42,8 +43,8 @@
 
 import org.apache.cxf.BusException;
 import org.apache.cxf.binding.BindingFactoryManager;
-import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointException;
 import org.apache.cxf.endpoint.EndpointImpl;
@@ -102,8 +103,8 @@
     public static final String ELEMENT_NAME = "messagepart.elementName";
     public static final String METHOD = "operation.method";
 
-    private static final Logger LOG = Logger.getLogger(ReflectionServiceFactoryBean.class.getName());
-    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(ReflectionServiceFactoryBean.class);
+    private static final Logger LOG = LogUtils.getL7dLogger(ReflectionServiceFactoryBean.class,
+                                                            "SimpleMessages");
 
     protected String wsdlURL;
 
@@ -217,6 +218,11 @@
 
     protected void buildServiceFromClass() {
         LOG.info("Creating Service " + getServiceQName() + " from class " + getServiceClass().getName());
+        
+        if (Proxy.isProxyClass(this.getServiceClass())) {
+            LOG.log(Level.WARNING, "USING_PROXY_FOR_SERVICE", getServiceClass());
+        }
+        
         ServiceInfo serviceInfo = new ServiceInfo();
         ServiceImpl service = new ServiceImpl(serviceInfo);
 
@@ -283,7 +289,7 @@
                 return si.getInterface();
             }
         }
-        throw new ServiceConstructionException(new Message("COULD_NOT_FIND_PORTTYPE", BUNDLE,
qn));
+        throw new ServiceConstructionException(new Message("COULD_NOT_FIND_PORTTYPE", LOG,
qn));
     }
 
     protected void initializeWSDLOperations() {
@@ -313,7 +319,7 @@
             }
 
             if (selected == null) {
-                throw new ServiceConstructionException(new Message("NO_METHOD_FOR_OP", BUNDLE,
o.getName()));
+                throw new ServiceConstructionException(new Message("NO_METHOD_FOR_OP", LOG,
o.getName()));
             }
 
             initializeWSDLOperation(intf, o, selected);

Copied: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
(from r570457, incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties?p2=incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties&p1=incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties&r1=570457&r2=570596&rev=570596&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/Messages.properties
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
Tue Aug 28 17:14:32 2007
@@ -20,4 +20,9 @@
 #
 COULD_NOT_FIND_PORTTYPE = Could not find portType named {0}
 NO_METHOD_FOR_OP = Could not find a matching method for operation {0}
-COULD_NOT_SET_WRAPPER_STYLE = Service class : {0} contains overloaded operation can not use
wrapper style
\ No newline at end of file
+COULD_NOT_SET_WRAPPER_STYLE = Service class: {0} contains overloaded operation can not use
wrapper style
+USING_PROXY_FOR_SERVICE = Service class: {0} is a java.lang.reflect.Proxy instance.  This
is known not to work well as \
+  annotations on the real instance are not available.  We suggest overriding the ServiceClass
via spring config or \
+  other configuration. (serviceClass/implementorClass attributes on the endpoint/server spring
config entry)
+ 
+ 
\ No newline at end of file

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=570596&r1=570595&r2=570596&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
Tue Aug 28 17:14:32 2007
@@ -58,7 +58,7 @@
 
     @BeforeClass
     public static void startServers() throws Exception {
-        assertTrue("server did not launch correctly", launchServer(ServerMisc.class, true));
+        assertTrue("server did not launch correctly", launchServer(ServerMisc.class));
     }
 
     @Test

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=570596&r1=570595&r2=570596&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Tue Aug 28 17:14:32 2007
@@ -22,6 +22,9 @@
 
 
 import java.io.InputStream;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
 import java.lang.reflect.UndeclaredThrowableException;
 import java.net.HttpURLConnection;
 import java.net.URISyntaxException;
@@ -39,6 +42,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.AsyncHandler;
 import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Endpoint;
 import javax.xml.ws.Response;
 import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
@@ -846,5 +850,23 @@
         assertEquals("Hello CXF", result);
     }
 
+    @Test
+    public void testProxy() throws Exception {
+        InvocationHandler handler = new InvocationHandler() {
+
+            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
+                // TODO Auto-generated method stub
+                return null;
+            }
+            
+        };
+        Object implementor4 = Proxy.newProxyInstance(this.getClass().getClassLoader(),
+                                                     new Class<?>[] {DocLitWrappedCodeFirstService.class},
+                                                     handler);
+        Endpoint.publish("http://localhost:9023/DocLitWrappedCodeFirstService/", implementor4);
+        URL url = new URL("http://localhost:9023/DocLitWrappedCodeFirstService/?wsdl");
+        InputStream ins = url.openStream();
+        ins.close();
+    }
     
 }



Mime
View raw message