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 na...@apache.org on 2008/08/14 19:04:58 UTC

svn commit: r685961 - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws: c/ cpp/ info/

Author: nadiramra
Date: Thu Aug 14 10:04:56 2008
New Revision: 685961

URL: http://svn.apache.org/viewvc?rev=685961&view=rev
Log:
Simplify, remove redundant code. 

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamHeaderWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/CFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/HeaderFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParamCFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/CPPClassWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClassLoader.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ExceptionHeaderWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ExceptionWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/HeaderFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WSDLInfo.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WrapperInfo.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamHeaderWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamHeaderWriter.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamHeaderWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamHeaderWriter.java Thu Aug 14 10:04:56 2008
@@ -98,9 +98,6 @@
     protected File getFilePath(boolean useServiceName) throws WrapperFault
     {
         String targetOutputLocation = this.wscontext.getWrapperInfo().getTargetOutputLocation();
-        if (targetOutputLocation.endsWith("/"))
-            targetOutputLocation = targetOutputLocation.substring(0,targetOutputLocation.length() - 1);
-
         new File(targetOutputLocation).mkdirs();
 
         String fileName = targetOutputLocation + "/" + classname + CUtils.C_HEADER_SUFFIX;

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java Thu Aug 14 10:04:56 2008
@@ -221,9 +221,6 @@
     protected File getFilePath(boolean useServiceName) throws WrapperFault
     {
         String targetOutputLocation = this.wscontext.getWrapperInfo().getTargetOutputLocation();
-        if (targetOutputLocation.endsWith("/"))
-            targetOutputLocation = targetOutputLocation.substring(0,targetOutputLocation.length() - 1);
-
         new File(targetOutputLocation).mkdirs();
 
         String fileName = targetOutputLocation + "/" + classname + CUtils.C_FILE_SUFFIX;

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/CFileWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/CFileWriter.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/CFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/CFileWriter.java Thu Aug 14 10:04:56 2008
@@ -92,9 +92,6 @@
     protected File getFilePath(boolean useServiceName) throws WrapperFault
     {
         String targetOutputLocation = this.wscontext.getWrapperInfo().getTargetOutputLocation();
-        if (targetOutputLocation.endsWith("/"))
-            targetOutputLocation = targetOutputLocation.substring(0,targetOutputLocation.length() - 1);
-
         new File(targetOutputLocation).mkdirs();
         String fileName = targetOutputLocation + "/" + classname + CUtils.C_FILE_SUFFIX;
 

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/HeaderFileWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/HeaderFileWriter.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/HeaderFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/HeaderFileWriter.java Thu Aug 14 10:04:56 2008
@@ -102,9 +102,6 @@
     protected File getFilePath(boolean useServiceName) throws WrapperFault
     {
         String targetOutputLocation = this.wscontext.getWrapperInfo().getTargetOutputLocation();
-        if (targetOutputLocation.endsWith("/"))
-            targetOutputLocation = targetOutputLocation.substring(0,targetOutputLocation.length() - 1);
-
         new File(targetOutputLocation).mkdirs();
 
         String fileName = targetOutputLocation + "/" + classname + ".h";

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParamCFileWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParamCFileWriter.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParamCFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParamCFileWriter.java Thu Aug 14 10:04:56 2008
@@ -100,9 +100,6 @@
     protected File getFilePath() throws WrapperFault
     {
         String targetOutputLocation = this.wscontext.getWrapperInfo().getTargetOutputLocation();
-        if (targetOutputLocation.endsWith("/"))
-            targetOutputLocation = targetOutputLocation.substring(0,targetOutputLocation.length() - 1);
-
         new File(targetOutputLocation).mkdirs();
         String fileName = targetOutputLocation + "/" + this.classname + CUtils.C_FILE_SUFFIX;
         this.wscontext.addGeneratedFile(classname + CUtils.C_FILE_SUFFIX);

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java Thu Aug 14 10:04:56 2008
@@ -336,8 +336,6 @@
     protected File getFilePath(boolean useServiceName) throws WrapperFault
     {
         String targetOutputLocation = this.wscontext.getWrapperInfo().getTargetOutputLocation();
-        if (targetOutputLocation.endsWith("/"))
-            targetOutputLocation = targetOutputLocation.substring(0,targetOutputLocation.length() - 1);
         new File(targetOutputLocation).mkdirs();
 
         String fileName = targetOutputLocation + "/" + classname + CUtils.C_HEADER_SUFFIX;

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/CPPClassWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/CPPClassWriter.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/CPPClassWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/CPPClassWriter.java Thu Aug 14 10:04:56 2008
@@ -85,29 +85,15 @@
 
     protected File getFilePath(boolean useServiceName) throws WrapperFault
     {
-        String targetOutputLocation =
-            this.wscontext.getWrapperInfo().getTargetOutputLocation();
-        if (targetOutputLocation.endsWith("/"))
-            targetOutputLocation =
-                targetOutputLocation.substring(
-                    0,
-                    targetOutputLocation.length() - 1);
+        String targetOutputLocation = this.wscontext.getWrapperInfo().getTargetOutputLocation();
         new File(targetOutputLocation).mkdirs();
-    
         String fileName = targetOutputLocation + "/" + classname + CUtils.CPP_CLASS_SUFFIX;
     
         if (useServiceName)
         {
             String serviceName = this.wscontext.getServiceInfo().getServicename();
-            fileName =
-                targetOutputLocation
-                    + "/"
-                    + serviceName
-                    + "_"
-                    + classname
-                    + CUtils.CPP_CLASS_SUFFIX;
-            this.wscontext.addGeneratedFile(
-                serviceName + "_" + classname + CUtils.CPP_CLASS_SUFFIX);
+            fileName = targetOutputLocation + "/" + serviceName + "_" + classname + CUtils.CPP_CLASS_SUFFIX;
+            this.wscontext.addGeneratedFile(serviceName + "_" + classname + CUtils.CPP_CLASS_SUFFIX);
         }
         else
         {

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClassLoader.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClassLoader.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClassLoader.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClassLoader.java Thu Aug 14 10:04:56 2008
@@ -122,24 +122,11 @@
 
     protected File getFilePath() throws WrapperFault
     {
-        String targetOutputLocation =
-            this.wscontext.getWrapperInfo().getTargetOutputLocation();
-        if (targetOutputLocation.endsWith("/"))
-        {
-            targetOutputLocation =
-                targetOutputLocation.substring(
-                    0,
-                    targetOutputLocation.length() - 1);
-        }
+        String targetOutputLocation = this.wscontext.getWrapperInfo().getTargetOutputLocation();
         new File(targetOutputLocation).mkdirs();
-        String fileName =
-            targetOutputLocation
-                + "/"
-                + classname
-                + CUtils.CLASS_LOADER_APPENDER
-                + CUtils.CPP_CLASS_SUFFIX;
-        this.wscontext.addGeneratedFile(
-            classname + CUtils.CLASS_LOADER_APPENDER + CUtils.CPP_CLASS_SUFFIX);
+        String fileName = targetOutputLocation
+                + "/" + classname + CUtils.CLASS_LOADER_APPENDER + CUtils.CPP_CLASS_SUFFIX;
+        this.wscontext.addGeneratedFile(classname + CUtils.CLASS_LOADER_APPENDER + CUtils.CPP_CLASS_SUFFIX);
         return new File(fileName);
     }
 

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ExceptionHeaderWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ExceptionHeaderWriter.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ExceptionHeaderWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ExceptionHeaderWriter.java Thu Aug 14 10:04:56 2008
@@ -57,22 +57,10 @@
 
     protected File getFilePath(boolean useServiceName) throws WrapperFault
     {
-        String targetOutputLocation =
-            this.wscontext.getWrapperInfo().getTargetOutputLocation();
-        if (targetOutputLocation.endsWith("/"))
-        {
-            targetOutputLocation =
-                targetOutputLocation.substring(
-                    0,
-                    targetOutputLocation.length() - 1);
-        }
+        String targetOutputLocation = this.wscontext.getWrapperInfo().getTargetOutputLocation();
         new File(targetOutputLocation).mkdirs();
 
-        String fileName =
-            targetOutputLocation
-                + "/"
-                + faultInfoName
-                + CUtils.CPP_HEADER_SUFFIX;
+        String fileName = targetOutputLocation + "/" + faultInfoName + CUtils.CPP_HEADER_SUFFIX;
 
         if (useServiceName)
         {

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ExceptionWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ExceptionWriter.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ExceptionWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ExceptionWriter.java Thu Aug 14 10:04:56 2008
@@ -62,43 +62,19 @@
      */
     protected File getFilePath(boolean useServiceName) throws WrapperFault
     {
-        String targetOutputLocation =
-            this.wscontext.getWrapperInfo().getTargetOutputLocation();
-        if (targetOutputLocation.endsWith("/"))
-        {
-            targetOutputLocation =
-                targetOutputLocation.substring(
-                    0,
-                    targetOutputLocation.length() - 1);
-        }
+        String targetOutputLocation = this.wscontext.getWrapperInfo().getTargetOutputLocation();
         new File(targetOutputLocation).mkdirs();
 
-        String fileName =
-            targetOutputLocation
-                + "/"
-                + faultInfoName
-                + CUtils.CPP_CLASS_SUFFIX;
+        String fileName = targetOutputLocation + "/" + faultInfoName + CUtils.CPP_CLASS_SUFFIX;
 
         if (useServiceName)
         {
-            fileName =
-                targetOutputLocation
-                    + "/"
-                    + this.getServiceName()
-                    + "_"
-                    + faultInfoName
-                    + CUtils.CPP_CLASS_SUFFIX;
-
-            this.wscontext.addGeneratedFile(
-                this.getServiceName()
-                    + "_"
-                    + faultInfoName
-                    + CUtils.CPP_CLASS_SUFFIX);
+            fileName = targetOutputLocation + "/" + this.getServiceName() + "_" + faultInfoName + CUtils.CPP_CLASS_SUFFIX;
+            this.wscontext.addGeneratedFile(this.getServiceName() + "_" + faultInfoName + CUtils.CPP_CLASS_SUFFIX);
         }
         else
         {
-            this.wscontext.addGeneratedFile(
-                faultInfoName + CUtils.CPP_CLASS_SUFFIX);
+            this.wscontext.addGeneratedFile(faultInfoName + CUtils.CPP_CLASS_SUFFIX);
         }
         return new File(fileName);
     }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/HeaderFileWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/HeaderFileWriter.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/HeaderFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/HeaderFileWriter.java Thu Aug 14 10:04:56 2008
@@ -121,29 +121,14 @@
     }
     protected File getFilePath(boolean useServiceName) throws WrapperFault
     {
-        String targetOutputLocation =
-            this.wscontext.getWrapperInfo().getTargetOutputLocation();
-        if (targetOutputLocation.endsWith("/"))
-        {
-            targetOutputLocation =
-                targetOutputLocation.substring(
-                    0,
-                    targetOutputLocation.length() - 1);
-        }
+        String targetOutputLocation = this.wscontext.getWrapperInfo().getTargetOutputLocation();
         new File(targetOutputLocation).mkdirs();
 
-        String fileName =
-            targetOutputLocation + "/" + classname + CUtils.CPP_HEADER_SUFFIX;
+        String fileName = targetOutputLocation + "/" + classname + CUtils.CPP_HEADER_SUFFIX;
 
         if (useServiceName)
         {
-            fileName =
-                targetOutputLocation
-                    + "/"
-                    + this.getServiceName()
-                    + "_"
-                    + classname
-                    + CUtils.CPP_HEADER_SUFFIX;
+            fileName = targetOutputLocation + "/" + this.getServiceName() + "_" + classname + CUtils.CPP_HEADER_SUFFIX;
         }
 
         return new File(fileName);

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java Thu Aug 14 10:04:56 2008
@@ -479,9 +479,6 @@
     protected File getFilePath(boolean useServiceName) throws WrapperFault
     {
         String targetOutputLocation = this.wscontext.getWrapperInfo().getTargetOutputLocation();
-        if (targetOutputLocation.endsWith("/"))
-            targetOutputLocation = targetOutputLocation.substring(0,targetOutputLocation.length() - 1);
-
         new File(targetOutputLocation).mkdirs();
 
         String fileName = targetOutputLocation + "/" + classname + CUtils.CPP_HEADER_SUFFIX;

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WSDLInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WSDLInfo.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WSDLInfo.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WSDLInfo.java Thu Aug 14 10:04:56 2008
@@ -27,13 +27,19 @@
 import javax.wsdl.BindingOperation;
 import javax.wsdl.BindingOutput;
 import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPBinding;
 import javax.wsdl.extensions.soap.SOAPOperation;
 
+import javax.xml.namespace.QName;
+
+import org.apache.axis.Constants;
 import org.apache.axis.wsdl.gen.Parser;
 import org.apache.axis.wsdl.symbolTable.BindingEntry;
 import org.apache.axis.wsdl.symbolTable.ServiceEntry;
 import org.apache.axis.wsdl.symbolTable.SymTabEntry;
 import org.apache.axis.wsdl.symbolTable.SymbolTable;
+import org.apache.axis.wsdl.wsdl2ws.WrapperFault;
 
 
 /**
@@ -45,30 +51,34 @@
  */
 public class WSDLInfo
 {
-    /** verbose flag */
+    // verbose flag 
     private boolean c_verbose = false;
     
-    /** parser timeout value, in seconds. 0=no timeout. */
+    // parser timeout value, in seconds. 0=no timeout. 
     private long c_timeout = 0;
     
-    /** URI to WSDL document. */
+    // URI to WSDL document. 
     private String c_URIToWSDLDocument = null;
     
-    /** Whether wrapper-style is not requested. */
+    // Whether wrapper-style is not requested. 
     private boolean c_noWrapperStyle = false;
     
-    /** WSDL parser from the last time parse() was invoked. */
+    // WSDL parser from the last time parse() was invoked. 
     private Parser c_wsdlParser = null;
     
-    /** Target name space of WSDL */
+    // Symbol table associated with the parser.
+    private SymbolTable c_symbolTable = null;
+    
+    // Target name space of WSDL 
     private String c_targetNameSpaceOfWSDL = null;
     
-    /** Service definitions in WSDL */
+    // Service definitions in WSDL 
     ArrayList c_services = new ArrayList();
     
-    /** Bindings in WSDL */
+    // Maps service definition to set of ports that use RPC binding style 
     ArrayList c_bindings = new ArrayList();
     
+    
     /**
      * Constructor.
      */
@@ -99,53 +109,17 @@
 
         // Parse the WSDL document.
         c_wsdlParser.run(c_URIToWSDLDocument);
+        c_symbolTable =  c_wsdlParser.getSymbolTable();
         
         // Dump symbol table if in verbose mode.
         if (c_verbose)
-            c_wsdlParser.getSymbolTable().dump(System.out);
+            c_symbolTable.dump(System.out);
         
         // Collect various bits of information from the document.
         processWSDLDocument();
 
         // Return the symbol table
-        return c_wsdlParser.getSymbolTable();
-    }
-
-    /**
-     * Collects all the information by the wsdl2ws tool.
-     */
-    private void processWSDLDocument() throws Exception
-    {
-        SymbolTable symbolTable =  c_wsdlParser.getSymbolTable();
-        
-        // Get target name space of WSDL
-        c_targetNameSpaceOfWSDL = symbolTable.getDefinition().getTargetNamespace();
-
-        // ==================================================
-        // Collect services and bindings.   
-        // ==================================================                
-        
-        Iterator it = symbolTable.getHashMap().values().iterator();
-        while (it.hasNext())
-        {
-            Vector v = (Vector) it.next();
-            for (int i = 0; i < v.size(); ++i)
-            {
-                SymTabEntry entry = (SymTabEntry) v.elementAt(i);
-
-                if (entry instanceof ServiceEntry)
-                {
-                    c_services.add(((ServiceEntry) entry).getService());
-                }
-                else if (entry instanceof BindingEntry)
-                {
-                    // Currently we are only interested in SOAP bindings.
-                    BindingEntry be = (BindingEntry)entry;
-                    if (be.getBindingType() == BindingEntry.TYPE_SOAP)
-                        c_bindings.add(entry);
-                }
-            }
-        }
+        return c_symbolTable;
     }
 
     /**
@@ -206,7 +180,6 @@
     {
         // we are checking only the first port.
         // if the targetEndPointURI not specifed we continue having it null
-        // The WrapperInfo will set a default value for the targetEndPointURI
 
         if (ports.hasNext())
         {
@@ -285,4 +258,163 @@
         }
         return null;
     }
+    
+    /**
+     * Returns list of Port objects in the specified service.  All ports in the list 
+     * will either have a binding style of document or rpc (i.e. one or the other) and
+     * uses the SOAP 1.1 binding. 
+     * 
+     * @param s
+     * @param styleDocument
+     * @return
+     * @throws Exception
+     */
+    public ArrayList getPortsSOAP11(Service s, boolean styleDocument) throws Exception
+    {
+        return getServicePorts(s, styleDocument, true, false, false);
+    }
+    
+    /**
+     * Returns list of Port objects in the specified service.  All ports in the list 
+     * will either have a binding style of document or rpc (i.e. one or the other) and
+     * uses the SOAP 1.2 binding. 
+     * 
+     * @param s
+     * @param styleDocument
+     * @return
+     * @throws Exception
+     */
+    public ArrayList getPortsSOAP12Document(Service s, boolean styleDocument) throws Exception
+    {
+        return getServicePorts(s, styleDocument, false, true, false);
+    }
+    
+    /**
+     * Returns list of Port objects in the specified service.  All ports in the list 
+     * uses the HTTP binding. 
+     * 
+     * @param s
+     * @param styleDocument
+     * @return
+     * @throws Exception
+     */
+    public ArrayList getPortsREST(Service s) throws Exception
+    {
+        return getServicePorts(s, true, false, false, true);
+    }
+
+    /**
+     * Returns list of Port objects in a service definition based on selection criteria.
+     * 
+     * @param s              service definition.
+     * @param styleDocument  true=return document style; false=return "rpc" style. 
+     *                       This parameter is ignored for REST (HTTP) bindings.
+     * @param soap11         true=return SOAP 1.1 bindings; false=SOAP 1.1 bindings are ignored.
+     * @param soap12         true=return SOAP 1.2 bindings; false=SOAP 1.2 bindings are ignored.
+     * @param rest           true=return HTTP bindings; false=ignore HTTP bindings.
+     * @return               List of ports that match selection criteria.
+     * @throws Exception
+     */
+    private ArrayList getServicePorts(Service s, 
+                                      boolean styleDocument, 
+                                      boolean soap11, 
+                                      boolean soap12, 
+                                      boolean rest) throws Exception
+    {        
+        ArrayList a = new ArrayList();
+        
+        if (s == null)
+            return a;
+
+        Iterator ports = s.getPorts().values().iterator();
+        while (ports.hasNext())
+        {
+            Port p = (Port) ports.next();
+            Binding b = p.getBinding();
+            BindingEntry be = c_symbolTable.getBindingEntry(b.getQName());
+            if (b == null || be == null)
+                throw new WrapperFault("No binding exists for port '" + p.getName() + "'.");
+            
+            if ((be.getBindingType() == BindingEntry.TYPE_SOAP)
+                    && (soap11 || soap12))
+            {
+                String style = be.getBindingStyle().getName();
+                if (style == null)
+                    style = "rpc"; // TODO need to revisit.
+                
+                if ((styleDocument && style.equalsIgnoreCase("document"))
+                        || (!styleDocument && style.equalsIgnoreCase("rpc")))
+                {
+                    SOAPBinding soapbinding = getSOAPBinding(b);
+                    if (soapbinding != null)
+                    {
+                        String ns = soapbinding.getElementType().getNamespaceURI();
+                        
+                        if ((soap11 && ns.equals(Constants.URI_WSDL11_SOAP))
+                                || (soap12 && ns.equals(Constants.URI_WSDL12_SOAP)))
+                                a.add(p);
+                    }
+                }
+            }
+            else if (rest && (be.getBindingType() == BindingEntry.TYPE_HTTP_GET 
+                                || be.getBindingType() == BindingEntry.TYPE_HTTP_POST))
+            {
+                a.add(p);
+            }
+        }
+        
+        return a;
+    }
+    
+    /**
+     * Collects all the information by the wsdl2ws tool.
+     */
+    private void processWSDLDocument() throws Exception
+    {        
+        // Get target name space of WSDL
+        c_targetNameSpaceOfWSDL = c_symbolTable.getDefinition().getTargetNamespace();
+
+        // Collect services and bindings.           
+        Iterator it = c_symbolTable.getHashMap().values().iterator();
+        while (it.hasNext())
+        {
+            Vector v = (Vector) it.next();
+            for (int i = 0; i < v.size(); ++i)
+            {
+                SymTabEntry entry = (SymTabEntry) v.elementAt(i);
+
+                if (entry instanceof ServiceEntry)
+                    c_services.add(((ServiceEntry) entry).getService());
+                else if (entry instanceof BindingEntry)
+                    c_bindings.add(entry);
+            }
+        }
+    }
+    
+    /**
+     * Returns SOAPBinding extensibility element from with a binding element.
+     * 
+     * @param b
+     * @return
+     */
+    private static SOAPBinding getSOAPBinding(Binding b)
+    {
+        if (b != null)
+        {
+            List extElems = b.getExtensibilityElements();
+            if (extElems != null)
+            {
+                Iterator it = extElems.iterator();
+                
+                while (it.hasNext())
+                {
+                    Object o = it.next();
+                    if (o instanceof javax.wsdl.extensions.soap.SOAPBinding)
+                        return (SOAPBinding)o;
+                }
+            }
+        }
+        
+        return null;
+    }
 }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WrapperInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WrapperInfo.java?rev=685961&r1=685960&r2=685961&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WrapperInfo.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WrapperInfo.java Thu Aug 14 10:04:56 2008
@@ -76,6 +76,8 @@
 
         if (targetOutputLocation == null)
             targetOutputLocation = ".";
+        if (targetOutputLocation.endsWith("/"))
+            targetOutputLocation = targetOutputLocation.substring(0, targetOutputLocation.length() - 1);
 
         if (targetEngine == null
                 || !WrapperConstants.CLIENT.equalsIgnoreCase(targetEngine))