axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject cvs commit: xml-axis/java/test/wsdl Wsdl2javaTestSuite.xml
Date Thu, 06 Dec 2001 16:48:41 GMT
scheu       01/12/06 08:48:41

  Modified:    java/src/org/apache/axis/wsdlgen Emitter.java
               java/test/wsdl Wsdl2javaTestSuite.xml
  Log:
  Java2WSDL:  Added support for "Holder" classes.
  Enabled JavaNames test...sorry Tom.
  
  Revision  Changes    Path
  1.16      +64 -6     xml-axis/java/src/org/apache/axis/wsdlgen/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdlgen/Emitter.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Emitter.java	2001/12/06 15:50:24	1.15
  +++ Emitter.java	2001/12/06 16:48:40	1.16
  @@ -544,7 +544,7 @@
                   offset = 1;
                   continue;
               }
  -            writePartToMessage(def, msg, "arg" + (i - offset), parameters[i]);
  +            writePartToMessage(def, msg, true, (i-offset), parameters[i], null); 
           }
   
           return msg;
  @@ -567,8 +567,20 @@
           msg.setUndefined(false);
   
           Class type = method.getReturnType();
  -        writePartToMessage(def, msg, method.getName().concat("Result"), type);
  +        writePartToMessage(def, msg, false, -1, type, method.getName().concat("Result"));
   
  +        Class[] parameters = method.getParameterTypes();
  +        int offset = 0;
  +        for(int i = 0, j = parameters.length; i < j; i++) {
  +            // If the first param is a MessageContext, Axis will
  +            // generate it for us - it shouldn't be in the WSDL.
  +            if ((i == 0) && MessageContext.class.equals(parameters[i])) {
  +                offset = 1;
  +                continue;
  +            }
  +            writePartToMessage(def, msg, false, (i-offset), parameters[i], null); 
  +        }
  +
           return msg;
       }
   
  @@ -576,17 +588,63 @@
        *
        * @param def  
        * @param msg             
  -     * @param name String name of part             
  -     * @param param  Class type of parameter             
  +     * @param request     message is for a request
  +     * @param num         parm number (-1 if return value)     
  +     * @param param       Class type of parameter             
  +     * @param paramName   optional name of parameter  
        * @throws Exception
        */
  -    public void writePartToMessage(Definition def, Message msg, String name, Class param)
throws Exception
  +    public void writePartToMessage(Definition def, Message msg, boolean request, int num,
Class param, String paramName) throws Exception
       {
  +        // Determine if this is a Holder class.  
  +        boolean holder = false;
  +        if (num >= 0 &&
  +            param.getName() != null &&
  +            param.getName().endsWith("Holder")) {
  +            // Holder is supposed to have a public value field.
  +            // (It appears the Wsdl2Java emits a _value field ??)
  +            java.lang.reflect.Field field;
  +            try {
  +                field = param.getField("value");
  +            } catch (Exception e) {
  +                field = null;
  +            }
  +            if (field == null) {
  +                try {
  +                    field = param.getField("_value");
  +                } catch (Exception e) {
  +                    field = null;
  +                }
  +            }
  +            // If this is a holder, set the flag and change param to the held type.
  +            if (field != null) {
  +                holder = true;
  +                param = field.getType();
  +            }
  +        }
  +
  +        // If Response message, only continue if holder or return
  +        if (!request && num >= 0 && !holder)
  +            return;
  +
  +        // Create a paramName
  +        if (paramName == null) {
  +            if (num == -1)
  +                paramName = "return";
  +            else if (holder)
  +                paramName = "inOut" + num;
  +            else
  +                paramName = "in" + num;
  +        }
  +
  +        // Create the Part
           Part part = def.createPart();
  +
  +        // Write the type representing the parameter type
           javax.wsdl.QName typeQName = types.writePartType(param);
           if (typeQName != null) {
               part.setTypeName(typeQName);
  -            part.setName(name);
  +            part.setName(paramName);
           }
           msg.addPart(part);
       }
  
  
  
  1.35      +0 -2      xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml
  
  Index: Wsdl2javaTestSuite.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- Wsdl2javaTestSuite.xml	2001/12/06 15:50:24	1.34
  +++ Wsdl2javaTestSuite.xml	2001/12/06 16:48:41	1.35
  @@ -336,7 +336,6 @@
       </wsdl2java>
       
       <!-- Check to make sure we map XML names that are illegal Java correctly -->
  -    <!--
       <wsdl2java url="test/wsdl/names/JavaNames.wsdl"
                  output="build/work"
                  deployscope="none"
  @@ -346,7 +345,6 @@
                  testcase="yes">
           <mapping namespace="http://test.com/reference" package="test.filegen"/>
       </wsdl2java>
  -    -->
   
       <!--
       <wsdl2java url="http://www.lemurlabs.com/projects/soap/fortune/FortuneService.wsdl"
  
  
  

Mime
View raw message