You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2006/01/10 07:57:16 UTC

svn commit: r367513 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/deployment/util/Utils.java core/src/org/apache/axis2/description/AxisService2WOM.java wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java

Author: deepal
Date: Mon Jan  9 22:56:59 2006
New Revision: 367513

URL: http://svn.apache.org/viewcvs?rev=367513&view=rev
Log:
- fixed some of problems in Java2WSDL
- Can not have overloaded methods in ServiceImpl class , if there are any then at the Java2WSDL time we throw an exception.
- If user want to have overload methods , it is possible to do that using having wsdl file in META-INF and writing his own message receiver.

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java?rev=367513&r1=367512&r2=367513&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java Mon Jan  9 22:56:59 2006
@@ -173,6 +173,10 @@
 
         for (int i = 0; i < method.length; i++) {
             JMethod jmethod = method[i];
+            if (!jmethod.isPublic()) {
+                // no need to expose , private and protected methods
+                continue;
+            }
             String opName = jmethod.getSimpleName();
             AxisOperation operation = axisService.getOperation(new QName(opName));
             // if the opeartion there in services.xml then try to set it schema element name
@@ -252,6 +256,10 @@
 
         for (int i = 0; i < method.length; i++) {
             JMethod jmethod = method[i];
+            if (!jmethod.isPublic()) {
+                // no need to expose , private and protected methods
+                continue;
+            }
             AxisOperation operation = getAxisOperationforJmethod(jmethod, table);
 
             // loading message recivers

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java?rev=367513&r1=367512&r2=367513&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java Mon Jan  9 22:56:59 2006
@@ -67,6 +67,9 @@
         DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
         DocumentBuilder domBuilder = domFactory.newDocumentBuilder();
         StringWriter writer = new StringWriter();
+        if(schema == null){
+            throw new Exception("no scheam found for the service");
+        }
         schema.write(writer);
         writer.flush();
         Document doc = domBuilder.parse(new ByteArrayInputStream(writer.toString().getBytes()));

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java?rev=367513&r1=367512&r2=367513&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java Mon Jan  9 22:56:59 2006
@@ -3,22 +3,11 @@
 import org.apache.axis2.wsdl.java2wsdl.bytecode.MethodTable;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.commons.schema.XmlSchemaComplexType;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaForm;
-import org.apache.ws.commons.schema.XmlSchemaSequence;
-import org.codehaus.jam.JClass;
-import org.codehaus.jam.JMethod;
-import org.codehaus.jam.JParameter;
-import org.codehaus.jam.JProperty;
-import org.codehaus.jam.JamClassIterator;
-import org.codehaus.jam.JamService;
-import org.codehaus.jam.JamServiceFactory;
-import org.codehaus.jam.JamServiceParams;
+import org.apache.ws.commons.schema.*;
+import org.codehaus.jam.*;
 
 import javax.xml.namespace.QName;
+import java.util.HashMap;
 import java.util.Hashtable;
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
@@ -128,11 +117,23 @@
              */
             methods = jclass.getDeclaredMethods();
 
+            // since we do not support overload
+            HashMap uniqueMethods = new HashMap();
+
             for (int i = 0; i < methods.length; i++) {
                 JMethod jMethod = methods[i];
                 //no need to think abt this method , since that is system config method
                 if (jMethod.getSimpleName().equals("init"))
                     continue;
+                if (uniqueMethods.get(jMethod.getSimpleName()) != null) {
+                    throw new Exception(" Sorry we don't support methods overloading !!!! ");
+                }
+
+                if (!jMethod.isPublic()) {
+                    // no need to generate Schema for non public methods
+                    continue;
+                }
+                uniqueMethods.put(jMethod.getSimpleName(), jMethod);
 
                 //it can easily get the annotations
 //                jMethod.getAnnotations();
@@ -195,7 +196,7 @@
     private void generateWrapperElements(JMethod methods[]) {
         for (int i = 0; i < methods.length; i++) {
             JMethod method = methods[i];
-            if (method.getSimpleName().equals("init"))
+            if (method.getSimpleName().equals("init") || !method.isPublic())
                 continue;
             genereteWrapperElementforMethod(method);
         }