You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2008/05/17 02:48:50 UTC

svn commit: r657261 - /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java

Author: nadiramra
Date: Fri May 16 17:48:50 2008
New Revision: 657261

URL: http://svn.apache.org/viewvc?rev=657261&view=rev
Log:
Minor - simplify code.

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java?rev=657261&r1=657260&r2=657261&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java Fri May 16 17:48:50 2008
@@ -82,9 +82,6 @@
 public class WSDL2Ws
 {
     public static boolean verbose = false;
-    
-    // we don't write out the make files anymore - 9th Nov 2005
-//    public static String makeSystem = null;
 
     private String language;
     private boolean wsdlWrappingStyle;
@@ -146,14 +143,32 @@
     public void preprocess() throws WrapperFault
     {
         typeMap = new TypeMap(language);
-        this.serviceentry = getServiceEntry();
-        Iterator ports = this.serviceentry.getService().getPorts().values().iterator();
+
+        // Get service definition.
+        // This code is taken from the org.apache.axis.wsdl.gen.Parser Class.
+        // WSDL file should have only one service, The first service found is utilized.
+        this.serviceentry = null;
+        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)
+                    this.serviceentry = (ServiceEntry) entry;
+            }
+        }
+        
+        if (this.serviceentry == null)
+            throw new WrapperFault("The service does not exist");
 
         //TODO  resolve this
         //        this code support only the service with onebindings it will not care about the
         //        second binding if exists.. if the NO binding specified it will failed
         //        this should be resolved by let user specify which binding to use.
-
+        Iterator ports = this.serviceentry.getService().getPorts().values().iterator();
         Binding binding = null;
         if (ports.hasNext())
             binding = ((Port) ports.next()).getBinding();
@@ -624,15 +639,12 @@
         return typeMap;
     }
 
-    public void generateWrappers(
-        String servicename,
-        String targetoutputLocation,
-        String targetLanguage,
-        String targetEngine,
-        String wsdlWrapStyle)
-        throws WrapperFault
+    public void generateWrappers(String servicename,
+                                 String targetoutputLocation,
+                                 String targetLanguage,
+                                 String targetEngine,
+                                 String wsdlWrapStyle) throws WrapperFault
     {
-
         if (targetLanguage == null)
             targetLanguage = "c++";
         if (targetEngine == null)
@@ -659,17 +671,12 @@
         this.getWebServiceInfo();
 
         //TODO    check whether the name at the WrapperConstant Doclit is right "doc"
-        WebServiceContext wsContext =new WebServiceContext(
-                new WrapperInfo(
-                        serviceStyle,
-                        targetLanguage,
-                        targetoutputLocation,
-                        targetEngine,
-                        transportURI,
-                        targetEndpointURI,
-                        targetNameSpaceOfWSDL),
-                    new ServiceInfo(servicename, qualifiedServiceName, methods),
-                    typeMap);  
+        WebServiceContext wsContext =
+            new WebServiceContext(new WrapperInfo(serviceStyle, targetLanguage, 
+                                                  targetoutputLocation, targetEngine,
+                                                  transportURI, targetEndpointURI, targetNameSpaceOfWSDL),
+                                  new ServiceInfo(servicename, qualifiedServiceName, methods), 
+                                  typeMap);  
         WebServiceGenerator wsg = WebServiceGeneratorFactory.createWebServiceGenerator(wsContext);
         
         if (wsg == null)
@@ -694,31 +701,6 @@
         wsg.generate();
     }
 
-
-    /**
-     * This code is taken from the org.apache.axis.wsdl.gen.Parser Class.
-     * WSDL file should have only one service, The first service 
-     * find is utilized.
-     * @return
-     * @throws WrapperFault
-     */
-    public ServiceEntry getServiceEntry() throws WrapperFault
-    {
-        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)
-                    return (ServiceEntry) entry;
-            }
-        }
-        throw new WrapperFault("the service does not exists");
-    }
-
     public Type createTypeInfo(QName typename, String targetLanguage)  throws WrapperFault
     {
         TypeEntry type = symbolTable.getType(typename);