[jbossws-commits] JBossWS SVN: r1558 - in branches/dlofthouse/JBWS-1260/src: main/java/org/jboss/ws/tools test/java/org/jboss/test/ws/tools/jbws1260

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Tue Dec 5 19:28:16 EST 2006


Author: darran.lofthouse at jboss.com
Date: 2006-12-05 19:28:12 -0500 (Tue, 05 Dec 2006)
New Revision: 1558

Modified:
   branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/WSDLToJava.java
   branches/dlofthouse/JBWS-1260/src/test/java/org/jboss/test/ws/tools/jbws1260/JBWS1260TestCase.java
Log:
JBWS-1260 - Source generation mostly fixed.

Modified: branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
--- branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/WSDLToJava.java	2006-12-05 23:29:55 UTC (rev 1557)
+++ branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/WSDLToJava.java	2006-12-06 00:28:12 UTC (rev 1558)
@@ -285,7 +285,7 @@
          //TODO: Take care of multiple outputs
          WSDLInterfaceOperationOutput[] outs = op.getOutputs();
          String returnType = getReturnType(outs);
-         buf.append("  public " + returnType + "  ");
+         buf.append("  public " + returnType + " ");
          buf.append(ToolsUtils.firstLetterLowerCase(op.getName().toString()));
          buf.append("(");
          WSDLInterfaceOperationInput[] ins = op.getInputs();
@@ -367,12 +367,13 @@
                buf.append(seiPkgName + "." + utils.firstLetterUpperCase(exceptionName));
             }
             else buf.append(cl.getName());
-            buf.append(",");
+            buf.append(", ");
          }
-         buf.append(" java.rmi.RemoteException");
+         buf.append("java.rmi.RemoteException");
          buf.append(";");
          buf.append(newline);
       }
+      buf.append(newline);
    }
 
    public boolean unwrapGroup(StringBuilder buf, String containingElement, XSModelGroup group) throws IOException
@@ -396,12 +397,24 @@
                buf.append(", ");
 
             XSElementDeclaration element = (XSElementDeclaration)term;
+            XSTypeDefinition type = element.getTypeDefinition();
             QName xmlName = new QName(element.getNamespace(), element.getName());
             QName xmlType = new QName(element.getTypeDefinition().getNamespace(), element.getTypeDefinition().getName());
             JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
             boolean array = particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1;
-            generateParameter(buf, null, containingElement, xmlType, xsmodel, element.getTypeDefinition(), array, !element.getNillable());
-            buf.append(" ").append(getMethodParam(containingElement));
+            generateParameter(buf, null, containingElement, xmlType, xsmodel, type, array, !element.getNillable());
+
+            String paramName;
+            if (type.getAnonymous())
+            {
+               paramName = containingElement;
+            }
+            else
+            {
+               paramName = element.getName();
+            }
+
+            buf.append(" ").append(getMethodParam(paramName));
          }
       }
 
@@ -450,15 +463,20 @@
          XSElementDeclaration unwrapped = unwrapType(xt);
          if (unwrapped != null)
          {
-            containingElement = containingElement + unwrapped.getName();
-            XSTypeDefinition unwrappedType = unwrapped.getTypeDefinition();
-
-            wrapped = unwrapElementParameters(buf, containingElement, unwrappedType);
+            xt = unwrapped.getTypeDefinition();
+            if (xt.getAnonymous() == false)
+            {
+               containingElement = unwrapped.getName();
+            }
+            else
+            {
+               containingElement = containingElement + unwrapped.getName();
+            }
+            wrapped = unwrapElementParameters(buf, containingElement, xt);
          }
          else
          {
-            // Type was not wrapped to set flag to handle as normal.
-            wrapped = false;
+            wrapped = unwrapElementParameters(buf, containingElement, xt);
          }
       }
 
@@ -522,7 +540,7 @@
       StringBuilder buf = new StringBuilder();
       utils.writeJbossHeader(buf);
       buf.append("package " + seiPkgName + ";" + newline);
-      buf.append("public interface  " + seiName + " extends java.rmi.Remote" + newline + "{" + newline);
+      buf.append("public interface " + seiName + " extends java.rmi.Remote" + newline + "{" + newline);
       appendMethods(intf, buf);
       buf.append("}" + newline);
 
@@ -567,7 +585,7 @@
    private String getReturnType(WSDLInterfaceOperationOutput[] outs) throws IOException
    {
       if (outs == null || outs.length == 0)
-         return "void ";
+         return "void";
       WSDLInterfaceOperationOutput out = outs[0];
 
       QName xmlType = out.getXMLType();
@@ -603,21 +621,17 @@
 
       Class cls = getJavaType(xmlType, primitive);
 
+      if (xt.getAnonymous()==false)
+      {
+        containingElement = xmlType.getLocalPart();   
+      }
+      
       if (xt instanceof XSComplexTypeDefinition)
          generateJavaSource((XSComplexTypeDefinition)xt, xsmodel, containingElement);
 
       if (cls == null)
-      {
-         String className;
-         if (xt.getAnonymous())
-         {
-            className = containingElement;
-         }
-         else
-         {
-            className = xmlType.getLocalPart();
-         }
-
+      {         
+         String className = containingElement;
          if (className.charAt(0) == '>')
             className = className.substring(1);
          className = utils.firstLetterUpperCase(className);

Modified: branches/dlofthouse/JBWS-1260/src/test/java/org/jboss/test/ws/tools/jbws1260/JBWS1260TestCase.java
===================================================================
--- branches/dlofthouse/JBWS-1260/src/test/java/org/jboss/test/ws/tools/jbws1260/JBWS1260TestCase.java	2006-12-05 23:29:55 UTC (rev 1557)
+++ branches/dlofthouse/JBWS-1260/src/test/java/org/jboss/test/ws/tools/jbws1260/JBWS1260TestCase.java	2006-12-06 00:28:12 UTC (rev 1558)
@@ -43,18 +43,18 @@
 
    static
    {
-      tests.add('A');
-      tests.add('B');
-      tests.add('C');
-      tests.add('D');
-      tests.add('E');
-      tests.add('F');
-      tests.add('G');
-      tests.add('H');
-      tests.add('I');
-      tests.add('J');
-      tests.add('K');
-      tests.add('L');
+      //tests.add('A');
+      //tests.add('B');
+      //tests.add('C');
+      //tests.add('D');
+       tests.add('E');
+      /* tests.add('F');
+       tests.add('G');
+       tests.add('H');
+       tests.add('I');
+       tests.add('J');
+       tests.add('K');
+       tests.add('L');*/
    }
 
    /**
@@ -76,16 +76,60 @@
       generateScenario('A');
    }
 
+   /**
+    * Test scenario where the element referenced as the message
+    * parts contains an anonymous complex type which contains
+    * two elements.
+    * 
+    * <element name='lookupResponse'>
+    *   <complexType>
+    *     <sequence>
+    *       <element name='areaCode' nillable='true' type='string'/> 
+    *       <element name='number' nillable='true' type='string'/>
+    *     </sequence>
+    *   </complexType>   
+    * </element>
+    * 
+    */
    public void testScenario_B() throws Exception
    {
       generateScenario('B');
    }
 
+   /**
+    * Test scenario where the element referenced as the message
+    * parts references a complex type which contains 
+    * a single element.
+    * 
+    * <element name='lookupResponse' type='tns:TelephoneNumber'/>
+    *  
+    * <complexType name='TelephoneNumber'>
+    *   <sequence>
+    *     <element name='number' nillable='true' type='string'/>
+    *   </sequence>
+    * </complexType> 
+    * 
+    */
    public void testScenario_C() throws Exception
    {
       generateScenario('C');
    }
 
+   /**
+    * Test scenario where the element referenced as the message
+    * parts references a complex type which contains two
+    * elements.
+    * 
+    * <element name='lookupResponse' type='tns:TelephoneNumber'/>
+    * 
+    * <complexType name='TelephoneNumber'>
+    *   <sequence>
+    *     <element name='areaCode' nillable='true' type='string'/>
+    *     <element name='number' nillable='true' type='string'/>
+    *   </sequence>
+    * </complexType>
+    * 
+    */
    public void testScenario_D() throws Exception
    {
       generateScenario('D');




More information about the jbossws-commits mailing list