geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r523542 - in /geronimo/server/trunk/modules: geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java
Date Thu, 29 Mar 2007 03:17:08 GMT
Author: dims
Date: Wed Mar 28 20:17:07 2007
New Revision: 523542

URL: http://svn.apache.org/viewvc?view=rev&rev=523542
Log:
Fix for GERONIMO-2977 - Axis2: process wsdlLocation annotation when wsdl-file property isn't
used in webservices.xml or there isn't webservices.xml

Modified:
    geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
    geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?view=diff&rev=523542&r1=523541&r2=523542
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
Wed Mar 28 20:17:07 2007
@@ -45,6 +45,7 @@
 import org.apache.axis2.util.MessageContextBuilder;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.jaxws.JAXWSUtils;
 import org.apache.geronimo.jaxws.JNDIResolver;
 import org.apache.geronimo.jaxws.PortInfo;
 import org.apache.geronimo.jaxws.ServerJNDIResolver;
@@ -100,6 +101,16 @@
         try {
             configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext();
             
+            //check to see if the wsdlLocation property is set in portInfo, 
+            //if not checking if wsdlLocation exists in annotation
+            //if already set, annotation should not overwrite it.
+            if (portInfo.getWsdlFile() == null || portInfo.getWsdlFile().equals("")){
+                Class clazz = classLoader.loadClass(endpointClassName);
+                //getwsdllocation from annotation if it exists
+                if (JAXWSUtils.containsWsdlLocation(clazz, classLoader))
+                    portInfo.setWsdlFile(JAXWSUtils.getServiceWsdlLocation(clazz, classLoader));
               
+            }
+
             if(portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().equals("")){
//WSDL file Has been provided
                 AxisServiceGenerator serviceGen = new AxisServiceGenerator();
                 service = serviceGen.getServiceFromWSDL(portInfo, endpointClassName, configurationBaseUrl,
classLoader);

Modified: geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java?view=diff&rev=523542&r1=523541&r2=523542
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java
Wed Mar 28 20:17:07 2007
@@ -146,5 +146,57 @@
             return name.trim();
         }  
     }
+
+    private static String getWsdlLocation(Class clazz) {
+        WebService webService = (WebService) clazz.getAnnotation(WebService.class); 
+        if (webService == null) {
+            WebServiceProvider webServiceProvider = 
+                (WebServiceProvider)clazz.getAnnotation(WebServiceProvider.class);
+            if (webServiceProvider == null) //no WebService or WebServiceProvider annotation
+                return "";
+            return webServiceProvider.wsdlLocation().trim();
+            
+        } else
+            return webService.wsdlLocation().trim();
+    } 
+    
+    private static String getServiceInterface(Class clazz) {
+        WebService webService = (WebService) clazz.getAnnotation(WebService.class); 
+        if (webService == null) {
+            //WebServiceProvider doesn't support endpointInterface property (JAX-WS 2.0 sec
7.7)
+            return "";  
+        } else {
+            if (webService.endpointInterface() != null & !webService.endpointInterface().equals(""))

+                return webService.endpointInterface();
+            else 
+                return "";
+        }
+
+    }
+    public static String getServiceWsdlLocation(Class clazz, ClassLoader loader) {
+        if (getWsdlLocation(clazz) != null && !getWsdlLocation(clazz).equals(""))
{
+            return getWsdlLocation(clazz);
+        }
+        else { //check if the interface contains the wsdlLocation value
+            String serviceInterfaceClassName = getServiceInterface(clazz);
+            if (serviceInterfaceClassName != null && !serviceInterfaceClassName.equals(""))
{
+                try {
+                    Class serviceInterfaceClass = loader.loadClass(getServiceInterface(clazz));
+                    return getWsdlLocation(serviceInterfaceClass);                    
+                } catch (Exception e) {
+                    return "";
+                }
+            } 
+        }
+        return "";
+        
+    }
+    
+    public static boolean containsWsdlLocation(Class clazz, ClassLoader loader) {
+        String wsdlLocSEIFromAnnotation = getServiceWsdlLocation(clazz, loader);
+        if (wsdlLocSEIFromAnnotation != null && !wsdlLocSEIFromAnnotation.equals(""))
+            return true;
+        return false;
+    }
     
 }



Mime
View raw message