scheu 02/02/19 07:06:52 Modified: java/samples/echo EchoService.java java/src/org/apache/axis/wsdl Skeleton.java SkeletonImpl.java java/src/org/apache/axis/wsdl/fromJava ClassRep.java Emitter.java MethodRep.java ParamRep.java java/src/org/apache/axis/wsdl/toJava JavaSkelWriter.java Log: The following changes are made - The emitted skeleton captures the mode as well as the name of the parameter. - Java2WSDL uses the mode information if available to generate the correct mode (i.e. it can now discern between inout and out modes). - EchoService has been changed to indicate the mode; thus requesting ?wsdl will return the correct wsdl for the echoStructAsSimpleTypes operation. - Minor improvements Revision Changes Path 1.18 +98 -1 xml-axis/java/samples/echo/EchoService.java Index: EchoService.java =================================================================== RCS file: /home/cvs/xml-axis/java/samples/echo/EchoService.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- EchoService.java 15 Feb 2002 19:41:16 -0000 1.17 +++ EchoService.java 19 Feb 2002 15:06:50 -0000 1.18 @@ -60,6 +60,7 @@ import java.util.HashMap; import org.apache.axis.encoding.Hex; +import javax.xml.rpc.ParameterMode; /** * Test implementation of the echo interop service. Original description of @@ -86,6 +87,16 @@ init(); return skel.getParameterName(opName, i); } + + public ParameterMode getParameterMode(String opName, int i) { + return skel.getParameterMode(opName, i); + } + + public static ParameterMode getParameterModeStatic(String opName, int i) { + init(); + return skel.getParameterMode(opName, i); + } + protected static void init() { if (skel != null) return; @@ -94,79 +105,140 @@ new String[] { "return", "inputString" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoStringArray", new String[] { "return", "inputStringArray" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoInteger", new String[] { "return", "inputInteger" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoIntegerArray", new String[] { "return", "inputIntegerArray" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoFloat", new String[] { "return", "inputFloat" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoFloatArray", new String[] { "return", "inputFloatArray" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoStruct", new String[] { "return", "inputStruct" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoStructArray", new String[] { "return", "inputStructArray" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoVoid", new String[] { - }); + }, + new ParameterMode[] {}); skel.add("echoBase64", new String[] { "return", "inputBase64" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoHexBinary", new String[] { "return", "inputHexBinary" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoDate", new String[] { "return", "inputDate" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoDecimal", new String[] { "return", "inputDecimal" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoBoolean", new String[] { "return", "inputBoolean" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoMap", new String[] { "return", "inputMap" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoMapArray", new String[] { "return", "inputMapArray" + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoStructAsSimpleTypes", new String[] { @@ -175,6 +247,13 @@ "outputString", "outputInteger", "outputFloat", + }, + new ParameterMode[] { + null, + ParameterMode.PARAM_MODE_IN, + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_OUT, }); skel.add("echoSimpleTypesAsStruct", new String[] { @@ -182,21 +261,39 @@ "inputString", "inputInteger", "inputFloat", + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN, + ParameterMode.PARAM_MODE_IN, + ParameterMode.PARAM_MODE_IN, }); skel.add("echo2DStringArray", new String[] { "return", "input2DStringArray", + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoNestedStruct", new String[] { "return", "inputStruct", + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); skel.add("echoNestedArray", new String[] { "return", "inputStruct", + }, + new ParameterMode[] { + ParameterMode.PARAM_MODE_OUT, + ParameterMode.PARAM_MODE_IN }); } 1.3 +17 -1 xml-axis/java/src/org/apache/axis/wsdl/Skeleton.java Index: Skeleton.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/Skeleton.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Skeleton.java 14 Jan 2002 19:18:52 -0000 1.2 +++ Skeleton.java 19 Feb 2002 15:06:51 -0000 1.3 @@ -53,6 +53,9 @@ * <http://www.apache.org/>. */ package org.apache.axis.wsdl; + +import javax.xml.rpc.ParameterMode; + /** * Interface for WSDL2Java generated skeletons */ @@ -66,6 +69,19 @@ /** * Note: The implementor should also provide a static version of the - * above class named getParameterNameStatic + * above method named getParameterNameStatic + */ + + /** + * Used to return the mode of the n-th parameter of the specified + * operation. Use -1 to get the return mode. + * Returns null if problems occur or the parameter is not known. */ + public ParameterMode getParameterMode(String operationName, int n); + + /** + * Note: The implementor should also provide a static version of the + * above method named getParameterModeStatic + */ + } 1.2 +34 -7 xml-axis/java/src/org/apache/axis/wsdl/SkeletonImpl.java Index: SkeletonImpl.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/SkeletonImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SkeletonImpl.java 12 Jan 2002 16:35:07 -0000 1.1 +++ SkeletonImpl.java 19 Feb 2002 15:06:51 -0000 1.2 @@ -55,6 +55,7 @@ package org.apache.axis.wsdl; import java.util.HashMap; +import javax.xml.rpc.ParameterMode; /** * Provides Base function implementation for the Skeleton interface @@ -71,26 +72,52 @@ } } + class NamesAndModes { + String[] names; + ParameterMode[] modes; + + NamesAndModes(String[] names, ParameterMode[] modes) { + this.names = names; + this.modes = modes; + } + } + /** * Add operation name and vector containing return and parameter names. * The first name in the array is either the return name (which * should be set to null if there is no return name) **/ - public void add(String operation, String[] names) { - table.put(operation, names); + public void add(String operation, String[] names, ParameterMode[] modes) { + table.put(operation, new NamesAndModes(names, modes)); } /** * Used to return the name of the n-th parameter of the specified - * operation. + * operation. Use -1 to get the return type name * Returns null if problems occur or the parameter is not known. */ public String getParameterName(String operationName, int n) { - String[] names = (String[]) table.get(operationName); - if (names == null || - names.length <= n+1) { + NamesAndModes value = (NamesAndModes) table.get(operationName); + if (value == null || + value.names == null || + value.names.length <= n+1) { + return null; + } + return value.names[n+1]; + } + + /** + * Used to return the mode of the n-th parameter of the specified + * operation. Use -1 to get the return mode. + * Returns null if problems occur or the parameter is not known. + */ + public ParameterMode getParameterMode(String operationName, int n) { + NamesAndModes value = (NamesAndModes) table.get(operationName); + if (value == null || + value.modes == null || + value.modes.length <= n+1) { return null; } - return (String) (names[n+1]); + return value.modes[n+1]; } } 1.16 +180 -96 xml-axis/java/src/org/apache/axis/wsdl/fromJava/ClassRep.java Index: ClassRep.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/ClassRep.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- ClassRep.java 18 Feb 2002 23:44:17 -0000 1.15 +++ ClassRep.java 19 Feb 2002 15:06:51 -0000 1.16 @@ -69,6 +69,11 @@ import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Vector; +import java.util.HashMap; + +import org.apache.axis.utils.JavaUtils; +import org.apache.axis.wsdl.Skeleton; +import javax.xml.rpc.ParameterMode; /** * ClassRep is the representation of a class used inside the Java2WSDL @@ -282,16 +287,18 @@ int mod = m[i].getModifiers(); if (Modifier.isPublic(mod)) { String methodName = m[i].getName(); - // Ignore the getParameterName methods from the Skeleton class + // Ignore the getParameterName/getParameterMode methods from the Skeleton class if (((methodName.equals("getParameterName") || - methodName.equals("getParameterNameStatic")) && - (Skeleton.class).isAssignableFrom(m[i].getDeclaringClass()))) { + methodName.equals("getParameterNameStatic") || + methodName.equals("getParameterMode") || + methodName.equals("getParameterModeStatic")) && + (Skeleton.class).isAssignableFrom(m[i].getDeclaringClass()))) { continue; // skip it } - short[] modes = getParameterModes(m[i]); Class[] types = getParameterTypes(m[i]); - _methods.add(new MethodRep(m[i], types, modes, - getParameterNames(m[i], implClass, types))); + String[] names = getParameterNames(m[i], implClass); + ParameterMode[] modes = getParameterModes(m[i], implClass); + _methods.add(new MethodRep(m[i], types, modes, names)); } } @@ -394,27 +401,8 @@ } /** - * Get the list of parameter modes for the specified method. - * This implementation assumes IN unless the type is a holder class - * @param method is the Method. - * @return array of parameter modes. - */ - protected short[] getParameterModes(Method method) { - short[] modes = new short[method.getParameterTypes().length]; - for (int i=0; i < method.getParameterTypes().length; i++) { - Class type = method.getParameterTypes()[i]; - if (JavaUtils.getHolderValueType(type) != null) { - modes[i] = ParamRep.INOUT; - } else { - modes[i] = ParamRep.IN; - } - } - return modes; - } - - /** * Get the list of parameter names for the specified method. - * This implementation uses Skeleton.getParameterNames or javap to get the parameter names + * This implementation uses Skeleton.getParameterNames or bcel to get the parameter names * from the class file. If parameter names are not available * for the method (perhaps the method is in an interface), the * corresponding method in the implClass is queried. @@ -424,7 +412,7 @@ * @param types are the parameter types after converting Holders. * @return array of Strings which represent the return name followed by parameter names */ - protected String[] getParameterNames(Method method, Class implClass, Class[] types) { + protected String[] getParameterNames(Method method, Class implClass) { String[] paramNames = null; paramNames = getParameterNamesFromSkeleton(method); @@ -432,12 +420,9 @@ return paramNames; } - paramNames = getParameterNames(method); + paramNames = getParameterNamesFromDebugInfo(method); - // If failed, try getting a method of the impl class - // It is possible that the impl class is a skeleton, thus the - // method may have a different signature (no Holders). This is - // why the method search is done with two parameter lists. + // If failed, try getting a method of the impl class. if (paramNames == null && implClass != null) { Method m = null; try { @@ -448,22 +433,12 @@ m = implClass.getMethod(method.getName(), method.getParameterTypes()); } catch (Exception e) {} } - if (m == null) { - try { - m = implClass.getDeclaredMethod(method.getName(), types); - } catch (Exception e) {} - } - if (m == null) { - try { - m = implClass.getMethod(method.getName(), types); - } catch (Exception e) {} - } if (m != null) { paramNames = getParameterNamesFromSkeleton(m); if (paramNames != null) { return paramNames; } - paramNames = getParameterNames(m); + paramNames = getParameterNamesFromDebugInfo(m); } } @@ -509,6 +484,168 @@ } /** + * get Parameter Names using bcel + * @param method + * @return list of names or null + */ + public String[] getParameterNamesFromDebugInfo(java.lang.reflect.Method method) { + Class c = method.getDeclaringClass(); + int numParams = method.getParameterTypes().length; + + // Don't worry about it if there are no params. + if (numParams == 0) + return null; + + // Try to make a tt-bytecode + BCMethod bmeth = null; + BCClass bclass = null; + try { + bclass = new BCClass(c); + } catch (IOException e) { + return null; // no dice + } + + // Obtain the exact method we're interested in. + bmeth = bclass.getMethod(method.getName(), method.getParameterTypes()); + + if (bmeth == null) + return null; + + // Get the Code object, which contains the local variable table. + Code code = bmeth.getCode(); + if (code == null) + return null; + + LocalVariableTableAttribute attr = + (LocalVariableTableAttribute)code.getAttribute(Constants.ATTR_LOCALS); + + if (attr == null) + return null; + + // OK, found it. Now scan through the local variables and record + // the names in the right indices. + LocalVariable [] vars = attr.getLocalVariables(); + + String [] argNames = new String[numParams + 1]; + argNames[0] = null; // don't know return name + + // NOTE: we scan through all the variables here, because I have been + // told that jikes sometimes produces unpredictable ordering of the + // local variable table. + for (int j = 0; j < vars.length; j++) { + LocalVariable var = vars[j]; + if (var.getIndex() <= numParams) { + if (var.getName().equals("this")) + continue; + argNames[var.getIndex()] = var.getName(); + } + } + return argNames; + } + + /** + * Get the list of return/parameter modes for the specified method. + * This implementation uses Skeleton.getParameterModes to get the modes + * If parameter modes are not available + * for the method (perhaps the method is in an interface), the + * corresponding method in the implClass is queried. + * @param method is the Method to search. + * @param implClass If the first search fails, the corresponding + * Method in this class is searched. + * @param types are the parameter types after converting Holders. + * @return array of Strings which represent the return mode followed by parameter modes + */ + protected ParameterMode[] getParameterModes(Method method, Class implClass) { + ParameterMode[] paramModes = null; + + paramModes = getParameterModesFromSkeleton(method); + if (paramModes != null) { + return paramModes; + } + + // If failed, try getting a method of the impl class + if (paramModes == null && implClass != null) { + Method m = null; + try { + m = implClass.getDeclaredMethod(method.getName(), method.getParameterTypes()); + } catch (Exception e) {} + if (m == null) { + try { + m = implClass.getMethod(method.getName(), method.getParameterTypes()); + } catch (Exception e) {} + } + if (m != null) { + paramModes = getParameterModesFromSkeleton(m); + } + } + + if (paramModes == null) { + paramModes = getParameterModes(method); + } + return paramModes; + } + + + /** + * Get the list of return/parameter modes for the specified method. + * This implementation uses Skeleton.getParameterModes to get the parameter modes + * from the class file. If parameter modes are not available, returns null. + * @param method is the Method to search. + * @return array of Strings which represent the return mode followed by parameter modes + */ + protected ParameterMode[] getParameterModesFromSkeleton(Method method) { + ParameterMode[] paramModes = null; + Class cls = method.getDeclaringClass(); + Class skel = Skeleton.class; + if (!cls.isInterface() && skel.isAssignableFrom(cls)) { + try { + // Use the getParameterModeStatic method so that we don't have to new up + // an object. + Method getParameterMode = cls.getMethod("getParameterModeStatic", + new Class [] {String.class, int.class}); + Skeleton skelObj = null; + if (getParameterMode == null) { + // Fall back to getting new instance + skelObj = (Skeleton) cls.newInstance(); + getParameterMode = cls.getMethod("getParameterMode", + new Class [] {String.class, int.class}); + } + + int numModes = method.getParameterTypes().length + 1; // Parms + return + paramModes = new ParameterMode[numModes]; + for (int i=0; i < numModes; i++) { + paramModes[i] = (ParameterMode) getParameterMode.invoke(skelObj, + new Object[] {method.getName(), + new Integer(i-1)}); + } + } catch (Exception e) { + } + } + return paramModes; + } + + /** + * Get the list of return/parameter modes for the specified method. + * This default implementation assumes IN unless the type is a holder class + * @param method is the Method. + * @return array of parameter modes. + */ + protected ParameterMode[] getParameterModes(Method method) { + ParameterMode[] modes = new ParameterMode[method.getParameterTypes().length+1]; + modes[0] = ParameterMode.PARAM_MODE_OUT; + for (int i=0; i < method.getParameterTypes().length; i++) { + Class type = method.getParameterTypes()[i]; + if (JavaUtils.getHolderValueType(type) != null) { + modes[i+1] = ParameterMode.PARAM_MODE_INOUT; + } else { + modes[i+1] = ParameterMode.PARAM_MODE_IN; + } + } + return modes; + } + + + /** * Determines if the Property in the class has been compliant accessors. If so returns true, * else returns false * @param cls the Class @@ -588,57 +725,4 @@ } return true; } - - public String[] getParameterNames(java.lang.reflect.Method method) { - Class c = method.getDeclaringClass(); - int numParams = method.getParameterTypes().length; - - // Don't worry about it if there are no params. - if (numParams == 0) - return null; - - // Try to make a tt-bytecode - BCMethod bmeth = null; - BCClass bclass = null; - try { - bclass = new BCClass(c); - } catch (IOException e) { - return null; // no dice - } - - // Obtain the exact method we're interested in. - bmeth = bclass.getMethod(method.getName(), method.getParameterTypes()); - - if (bmeth == null) - return null; - - // Get the Code object, which contains the local variable table. - Code code = bmeth.getCode(); - LocalVariableTableAttribute attr = - (LocalVariableTableAttribute)code.getAttribute(Constants.ATTR_LOCALS); - - if (attr == null) - return null; - - // OK, found it. Now scan through the local variables and record - // the names in the right indices. - LocalVariable [] vars = attr.getLocalVariables(); - - String [] argNames = new String[numParams + 1]; - argNames[0] = null; // don't know return name - - // NOTE: we scan through all the variables here, because I have been - // told that jikes sometimes produces unpredictable ordering of the - // local variable table. - for (int j = 0; j < vars.length; j++) { - LocalVariable var = vars[j]; - if (var.getIndex() <= numParams) { - if (var.getName().equals("this")) - continue; - argNames[var.getIndex()] = var.getName(); - } - } - return argNames; - } - }; 1.18 +1 -1 xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java Index: Emitter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- Emitter.java 18 Feb 2002 17:11:49 -0000 1.17 +++ Emitter.java 19 Feb 2002 15:06:51 -0000 1.18 @@ -384,7 +384,7 @@ name = null; } // if we got the name from the location, strip .jws from it - if (name.endsWith(".jws") ) { + if (name != null && name.endsWith(".jws") ) { name = name.substring(0, (name.length() - ".jws".length())); } 1.7 +26 -5 xml-axis/java/src/org/apache/axis/wsdl/fromJava/MethodRep.java Index: MethodRep.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/MethodRep.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- MethodRep.java 12 Feb 2002 20:22:03 -0000 1.6 +++ MethodRep.java 19 Feb 2002 15:06:51 -0000 1.7 @@ -58,6 +58,8 @@ import java.lang.reflect.Modifier; import java.util.Vector; +import javax.xml.rpc.ParameterMode; + /** * MethodRep is the representation of a class used inside the Java2WSDL * emitter. The information in the MethodRep can be changed by @@ -82,18 +84,37 @@ * Create a default representation of MethodRep * @param method Method to use to create default MethodRep * @param types This is an array of parameter types - * @param modes This is an array of parameter modes (IN, OUT, INOUT) + * @param modes This is an array of retrurn/parameter modes (IN, OUT, INOUT) or ParameterMode * @param paramNames This is an array of names to be used for the * return/parameter names. If null, default names * are constructed. */ + public MethodRep(Method method, Class[] types, ParameterMode[] pmodes, String[] paramNames) { + short[] modes = null; + if (pmodes != null) { + modes = new short[pmodes.length]; + for (int i=0; i < modes.length; i++) { + if (pmodes[i] != null && pmodes[i].equals(ParameterMode.PARAM_MODE_IN)) { + modes[i] = ParamRep.IN; + } else if (pmodes[i] != null && pmodes[i].equals(ParameterMode.PARAM_MODE_INOUT)) { + modes[i] = ParamRep.INOUT; + } else { + modes[i] = ParamRep.OUT; + } + } + } + init(method, types, modes, paramNames); + } public MethodRep(Method method, Class[] types, short[] modes, String[] paramNames) { + init(method, types, modes, paramNames); + } + protected void init(Method method, Class[] types, short[] modes, String[] paramNames) { _name = method.getName(); String retName = "return"; if ((paramNames != null) && (paramNames[0] != null) && !paramNames.equals("")) { retName = paramNames[0]; } - _returns = new ParamRep(retName, method.getReturnType(), ParamRep.OUT); + _returns = new ParamRep(retName, method.getReturnType(), modes[0]); // Create a ParamRep for each parameter. The holderClass() method // returns the name of the held type if this is a holder class. @@ -103,15 +124,15 @@ name = (String) paramNames[i+1]; } if (name == null || name.equals("") ) { - if (modes[i] == ParamRep.IN) { + if (modes[i+1] == ParamRep.IN) { name = "in" + i; - } else if (modes[i] == ParamRep.OUT) { + } else if (modes[i+1] == ParamRep.OUT) { name = "out" + i; } else { name = "inOut" + i; } } - _parameters.add(new ParamRep(name, types[i], modes[i])); + _parameters.add(new ParamRep(name, types[i], modes[i+1])); } } 1.2 +2 -0 xml-axis/java/src/org/apache/axis/wsdl/fromJava/ParamRep.java Index: ParamRep.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/ParamRep.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ParamRep.java 21 Dec 2001 21:14:57 -0000 1.1 +++ ParamRep.java 19 Feb 2002 15:06:51 -0000 1.2 @@ -54,6 +54,8 @@ */ package org.apache.axis.wsdl.fromJava; +import javax.xml.rpc.ParameterMode; + /** * ParamRep is the representation of a class used inside the Java2WSDL * emitter. The information in the ParamRep can be changed by 1.13 +30 -4 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java Index: JavaSkelWriter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- JavaSkelWriter.java 14 Feb 2002 14:59:31 -0000 1.12 +++ JavaSkelWriter.java 19 Feb 2002 15:06:52 -0000 1.13 @@ -135,7 +135,7 @@ pw.println(" init();"); pw.println(" }"); - // Initialize operation parameter names + // Initialize operation parameter names & modes pw.println(" public String getParameterName(String opName, int i) {"); pw.println(" return skel.getParameterName(opName, i);"); pw.println(" }"); @@ -145,6 +145,15 @@ pw.println(" return skel.getParameterName(opName, i);"); pw.println(" }"); pw.println(); + pw.println(" public javax.xml.rpc.ParameterMode getParameterMode(String opName, int i) {"); + pw.println(" return skel.getParameterMode(opName, i);"); + pw.println(" }"); + pw.println(); + pw.println(" public static javax.xml.rpc.ParameterMode getParameterModeStatic(String opName, int i) {"); + pw.println(" init();"); + pw.println(" return skel.getParameterMode(opName, i);"); + pw.println(" }"); + pw.println(); // Initialize operation parameter names pw.println(" protected static void init() {"); pw.println(" if (skel != null) "); @@ -162,13 +171,30 @@ pw.println(" skel.add(\"" + opName + "\","); pw.println(" new String[] {"); if (parameters.returnType != null) { - pw.println(" \"" + parameters.returnName + "\","); + pw.println(" \"" + parameters.returnName + "\","); } else { - pw.println(" null,"); + pw.println(" null,"); } for (int j=0; j < parameters.list.size(); j++) { Parameter p = (Parameter) parameters.list.get(j); - pw.println(" \"" + p.name + "\","); + pw.println(" \"" + p.name + "\","); + } + pw.println(" },"); + pw.println(" new javax.xml.rpc.ParameterMode[] {"); + if (parameters.returnType != null) { + pw.println(" javax.xml.rpc.ParameterMode.PARAM_MODE_OUT,"); + } else { + pw.println(" null,"); + } + for (int j=0; j < parameters.list.size(); j++) { + Parameter p = (Parameter) parameters.list.get(j); + if (p.mode == Parameter.IN) + pw.println(" javax.xml.rpc.ParameterMode.PARAM_MODE_IN,"); + else if (p.mode == Parameter.OUT) + pw.println(" javax.xml.rpc.ParameterMode.PARAM_MODE_INOUT,"); + else + pw.println(" javax.xml.rpc.ParameterMode.PARAM_MODE_OUT,"); + } pw.println(" });"); }