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/08/13 20:06:45 UTC

svn commit: r685627 - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws: SymbolTableParsingUtils.java WSDL2Ws.java info/WSDLInfo.java

Author: nadiramra
Date: Wed Aug 13 11:06:43 2008
New Revision: 685627

URL: http://svn.apache.org/viewvc?rev=685627&view=rev
Log:
Refactor, simplify, add comments.

Removed:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/SymbolTableParsingUtils.java
Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WSDLInfo.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=685627&r1=685626&r2=685627&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 Wed Aug 13 11:06:43 2008
@@ -253,7 +253,7 @@
             // ==================================================                
             
             ports = service.getPorts().values().iterator();
-            c_targetEndpointURI = SymbolTableParsingUtils.getTargetEndPointURI(ports);
+            c_targetEndpointURI = WSDLInfo.getTargetEndPointURI(ports);
         }
         catch (Exception e)
         {
@@ -455,9 +455,9 @@
                     if (method == null)
                         throw new WrapperFault("binding and the port type do not match");                    
                     
-                    method.setSoapAction(SymbolTableParsingUtils.getSoapAction(bindinop));
-                    SymbolTableParsingUtils.getInputInfo(bindinop.getBindingInput(), method);
-                    SymbolTableParsingUtils.getOutputInfo(bindinop.getBindingOutput(), method);
+                    method.setSoapAction(WSDLInfo.getSoapAction(bindinop));
+                    WSDLInfo.getInputInfo(bindinop.getBindingInput(), method);
+                    WSDLInfo.getOutputInfo(bindinop.getBindingOutput(), method);
                 }
             }
         }

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=685627&r1=685626&r2=685627&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 Wed Aug 13 11:06:43 2008
@@ -19,14 +19,23 @@
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Vector;
 
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Port;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
 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;
 
+
 /**
  * This class initiates the collection of various bits of information needed by the 
  * wsdl2ws tool by parsing the WSDL file.
@@ -193,4 +202,87 @@
         return c_services;
     }
     
+    public static String getTargetEndPointURI(Iterator ports)
+    {
+        // 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())
+        {
+            Port port = (Port) ports.next();
+            List adresslist = port.getExtensibilityElements();
+            if (adresslist != null
+                    && adresslist.size() != 0
+                    && (adresslist.get(0) instanceof javax.wsdl.extensions.soap.SOAPAddress))
+                return ((javax.wsdl.extensions.soap.SOAPAddress) adresslist.get(0))
+                        .getLocationURI();
+        }
+        return null;
+    }
+
+    public static String getTransportType(Binding binding)
+    {
+        List soapbinding = binding.getExtensibilityElements();
+        if (soapbinding != null
+                && soapbinding.size() > 0
+                && (soapbinding.get(0) instanceof javax.wsdl.extensions.soap.SOAPBinding))
+            return ((javax.wsdl.extensions.soap.SOAPBinding) soapbinding.get(0)).getTransportURI();
+        return null;
+    }
+
+    public static String getSoapAction(BindingOperation bindingOperation)
+    {
+        List extenstions = bindingOperation.getExtensibilityElements();
+        for (int i = 0; i < extenstions.size(); i++)
+        {
+            if (extenstions.get(i) instanceof SOAPOperation)
+                return ((SOAPOperation) extenstions.get(i)).getSoapActionURI();
+        }
+        return null;
+    }
+
+    public static List getInputInfo(BindingInput input, MethodInfo methodinfo)
+    {
+        if (input == null)
+            return null;
+        List soapbodies = input.getExtensibilityElements();
+
+        if (soapbodies != null)
+        {
+            for (int j = 0; j < soapbodies.size(); j++)
+            {
+                if (soapbodies.get(j) instanceof javax.wsdl.extensions.soap.SOAPBody)
+                {
+                    javax.wsdl.extensions.soap.SOAPBody body = ((javax.wsdl.extensions.soap.SOAPBody) soapbodies.get(j));
+                    methodinfo.setInputEncoding(body.getEncodingStyles());
+                    methodinfo.setInputUse(body.getUse());
+                    methodinfo.setInputNamespaceURI(body.getNamespaceURI());
+                }
+            }
+        }
+        return null;
+    }
+
+    public static List getOutputInfo(BindingOutput input, MethodInfo methodinfo)
+    {
+        if (input == null)
+            return null;
+        List soapbodies = input.getExtensibilityElements();
+
+        if (soapbodies != null)
+        {
+            for (int j = 0; j < soapbodies.size(); j++)
+            {
+                if (soapbodies.get(j) instanceof javax.wsdl.extensions.soap.SOAPBody)
+                {
+                    javax.wsdl.extensions.soap.SOAPBody body = ((javax.wsdl.extensions.soap.SOAPBody) soapbodies.get(j));
+                    methodinfo.setInputEncoding(body.getEncodingStyles());
+                    methodinfo.setInputUse(body.getUse());
+                    methodinfo.setOutputNamespaceURI(body.getNamespaceURI());
+                }
+            }
+        }
+        return null;
+    }
 }