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/15 21:15:57 UTC

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

Author: nadiramra
Date: Fri Aug 15 12:15:56 2008
New Revision: 686327

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

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/MethodInfo.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=686327&r1=686326&r2=686327&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 Aug 15 12:15:56 2008
@@ -424,6 +424,8 @@
             serviceMethods.add(minfo); 
         }
         
+        // Need to get some stuff from binding element such as SOAPAction and namespace for 
+        // each operation - we store the information in the method. 
         List operations = bindingEntry.getBinding().getBindingOperations();
         if (operations != null)
         {
@@ -442,11 +444,10 @@
                             method = (MethodInfo) serviceMethods.get(ii);
                     
                     if (method == null)
-                        throw new WrapperFault("binding and the port type do not match");                    
+                        throw new WrapperFault("The binding and portType elements do not match.");                    
                     
-                    method.setSoapAction(WSDLInfo.getSoapAction(bindinop));
-                    WSDLInfo.getInputInfo(bindinop.getBindingInput(), method);
-                    WSDLInfo.getOutputInfo(bindinop.getBindingOutput(), method);
+                    // Get binding operation information and store in method for later use.
+                    WSDLInfo.updateMethodInfoFromBinding(bindinop, method);
                 }
             }
         }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/MethodInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/MethodInfo.java?rev=686327&r1=686326&r2=686327&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/MethodInfo.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/MethodInfo.java Fri Aug 15 12:15:56 2008
@@ -23,7 +23,6 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.List;
 
 import javax.xml.namespace.QName;
 
@@ -35,17 +34,12 @@
     private Parameters operationParameters;
     private ArrayList inputParameters;
     private ArrayList outputParameters;
-    private String soapAction;
-    private List inputEncoding;
-    private List outputEncoding;
-    private String inputUse;
-    private String outputUse;
+    private String soapAction = null;
     private QName inputMessage;
     private QName outputMessage;
     private QName faultMessage;
     private ArrayList faultType;
     private String inputNamespaceURI = null;
-    private String outputNamespaceURI = null;
 
     private boolean eligibleForWrapped=true;
     private boolean doUnwrapped=false;
@@ -64,11 +58,6 @@
         return methodname;
     }
 
-    public void setMethodname(String methodname)
-    {
-        this.methodname = methodname;
-    }
-
     public Collection getInputParameterTypes()
     {
         return this.inputParameters;
@@ -99,56 +88,16 @@
         this.outputParameters.add(type);
     }
 
-    public List getInputEncoding()
-    {
-        return inputEncoding;
-    }
-
-    public List getOutputEncoding()
-    {
-        return outputEncoding;
-    }
-
     public String getSoapAction()
     {
         return soapAction;
     }
 
-    public void setInputEncoding(List string)
-    {
-        inputEncoding = string;
-    }
-
-    public void setOutputEncoding(List string)
-    {
-        outputEncoding = string;
-    }
-
     public void setSoapAction(String string)
     {
         soapAction = string;
     }
 
-    public String getInputUse()
-    {
-        return inputUse;
-    }
-
-    public String getOutputUse()
-    {
-        return outputUse;
-    }
-
-    public void setInputUse(String string)
-    {
-        inputUse = string;
-    }
-
-    public void setOutputUse(String string)
-    {
-        outputUse = string;
-    }
-
     public void setInputNamespaceURI(String string)
     {
         inputNamespaceURI = string;
@@ -159,16 +108,6 @@
         return inputNamespaceURI;
     }
 
-    public void setOutputNamespaceURI(String string)
-    {
-        outputNamespaceURI = string;
-    }
-
-    public String getOutputNamespaceURI()
-    {
-        return outputNamespaceURI;
-    }
-
     public QName getInputMessage()
     {
         return inputMessage;

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=686327&r1=686326&r2=686327&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 Fri Aug 15 12:15:56 2008
@@ -25,11 +25,11 @@
 import javax.wsdl.Binding;
 import javax.wsdl.BindingInput;
 import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
 import javax.wsdl.Port;
 import javax.wsdl.Service;
 import javax.wsdl.WSDLElement;
 import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
 import javax.wsdl.extensions.soap.SOAPOperation;
 import javax.wsdl.extensions.soap.SOAPAddress;
 
@@ -213,58 +213,24 @@
     }
 
     /**
-     * Returns the URI for SoapAction if it exists.
+     * Updates MethodInfo with information from the binding operation element.
      * 
-     * @param bindingOperation
-     * @return
+     * @param bindingOp
+     * @param method
      */
-    public static String getSoapAction(BindingOperation bindingOperation)
+    public static void updateMethodInfoFromBinding(BindingOperation bindingOp, MethodInfo method)
     {
-        SOAPOperation e = (SOAPOperation)getExtensibilityElement(bindingOperation, INSTANCEOF_SOAPOPERATION);
+        // Get SOAPAction
+        SOAPOperation e = (SOAPOperation)getExtensibilityElement(bindingOp, INSTANCEOF_SOAPOPERATION);
         if (e != null)
-            return e.getSoapActionURI();
-        return null;
-    }
-
-    public static void getInputInfo(BindingInput input, MethodInfo methodinfo)
-    {
-        if (input == null)
-            return;
-        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());
-                }
-            }
-        }
-    }
-
-    public static void getOutputInfo(BindingOutput input, MethodInfo methodinfo)
-    {
-        if (input == null)
-            return;
-        List soapbodies = input.getExtensibilityElements();
-
-        if (soapbodies != null)
+            method.setSoapAction(e.getSoapActionURI());
+        
+        // Get information about input operation
+        BindingInput  bi = bindingOp.getBindingInput();
+        SOAPBody body = (SOAPBody)getExtensibilityElement(bi, INSTANCEOF_SOAPBODY);
+        if (body != 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());
-                }
-            }
+            method.setInputNamespaceURI(body.getNamespaceURI());            
         }
     }