Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 19593 invoked by uid 500); 10 May 2002 22:38:51 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 19584 invoked by uid 500); 10 May 2002 22:38:50 -0000 Delivered-To: apmail-xml-axis-cvs@apache.org Date: 10 May 2002 22:38:50 -0000 Message-ID: <20020510223850.56662.qmail@icarus.apache.org> From: scheu@apache.org To: xml-axis-cvs@apache.org Subject: cvs commit: xml-axis/java/src/org/apache/axis/wsdl/fromJava Emitter.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N scheu 02/05/10 15:38:50 Modified: java/src/org/apache/axis/wsdl/fromJava Emitter.java Log: The reworking of the Java2WSDL tool broke the --implClass option. This processing has been restored. If Java2WSDL is passed an interface (portType) class, the -implClass is used to get the parameter names. I changed the code to construct a second ServiceDesc (serviceDesc2) representing the --implClass, if it is specified. Prior to calling the writeMessages method, the second ServiceDesc is searched for a matching OperationDesc (where match means the same operation name and parameter java types/modes). If found, the OperationDesc from the second ServiceDesc is passed to the writeMessages method...so that the appropriate parameters names are picked up. The --implClass option is extremely necessary when building an initial wsdl file from existing interfaces and classes. Enjoy! Revision Changes Path 1.32 +60 -2 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.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- Emitter.java 28 Apr 2002 18:10:57 -0000 1.31 +++ Emitter.java 10 May 2002 22:38:50 -0000 1.32 @@ -142,6 +142,7 @@ private String portTypeName; private ServiceDesc serviceDesc; + private ServiceDesc serviceDesc2; /** * Construct Emitter. @@ -211,13 +212,31 @@ serviceDesc.setImplClass(cls); //serviceDesc.setStyle(); TypeMappingRegistry tmr = new TypeMappingRegistryImpl(); - serviceDesc.setTypeMapping((TypeMapping)tmr.getDefaultTypeMapping()); + serviceDesc.setTypeMapping((TypeMapping) + tmr.getDefaultTypeMapping()); } serviceDesc.setStopClasses(stopClasses); serviceDesc.setAllowedMethods(allowedMethods); serviceDesc.setDisallowedMethods(disallowedMethods); + // If the class passed in is a portType, + // there may be an implClass that is used to + // obtain the method parameter names. In this case, + // a serviceDesc2 is built to get the method parameter names. + if (implCls != null && + implCls != cls && + serviceDesc2 == null) { + serviceDesc2 = new ServiceDesc(); + serviceDesc2.setImplClass(implCls); + TypeMappingRegistry tmr = new TypeMappingRegistryImpl(); + serviceDesc2.setTypeMapping((TypeMapping) + tmr.getDefaultTypeMapping()); + serviceDesc2.setStopClasses(stopClasses); + serviceDesc2.setAllowedMethods(allowedMethods); + serviceDesc2.setDisallowedMethods(disallowedMethods); + } + Document doc = null; Definition def = null; switch (mode) { @@ -565,7 +584,46 @@ binding, thisOper); Operation oper = bindingOper.getOperation(); - writeMessages(def, oper, thisOper); + + OperationDesc messageOper = thisOper; + if (serviceDesc2 != null) { + // If a serviceDesc contain an impl class is provided, + // try and locate the corresponding operation + // (same name, same parm types and modes). If a + // corresponding operation is found, it is sent + // to the writeMessages method so that its parameter + // names will be used in the wsdl file. + OperationDesc[] operArray = + serviceDesc2.getOperationsByName(thisOper.getName()); + boolean found = false; + if (operArray != null) { + for (int j=0; + j < operArray.length && !found; + j++) { + OperationDesc tryOper = operArray[j]; + if (tryOper.getParameters().size() == + thisOper.getParameters().size()) { + boolean parmsMatch = true; + for (int k=0; + k