By the way, the diffs below include a change to the WSDL2Java test case writer that prevent the emitted test method from catching *all* exceptions. It will just catch the exceptions defined to be throw in the operation.
The test itself is declared to throw Exception, which will then allow any unexpected exceptions to bubble up to JUnit, which I think is a good thing. This is something that Glen has been complaining about for something like forever. :-) This is only on the interop4 branch, which is expected to join the mainline sometime after next week. -- Tom Jordahl Macromedia Server Development -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 03, 2002 11:01 AM To: [EMAIL PROTECTED] Subject: cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava JavaTestCaseWriter.java JavaStubWriter.java JavaFaultWriter.java JavaDefinitionWriter.java tomj 2002/10/03 08:00:55 Modified: java/src/org/apache/axis/i18n Tag: interop4 resource.properties java/src/org/apache/axis/wsdl/toJava Tag: interop4 JavaTestCaseWriter.java JavaStubWriter.java JavaFaultWriter.java JavaDefinitionWriter.java Log: Add more changes for the correct processing of fault data. Some error checking and defensive coding changes. Get a (more) correct namespace in the writeDetails() emitted function. We have a problem in that the namespace of a fault can change per operation depending on the WSDL, and the function we emit to write the details element needs to know that namespace. Probably need to get the OperationDesc from the Serailization/Message context and have deploy writer put the fault info in to the WSDD. Still don't emit writeDetails() element for complex type faults, but simple types are working. Revision Changes Path No revision No revision 1.9.2.1 +2 -0 xml-axis/java/src/org/apache/axis/i18n/resource.properties Index: resource.properties =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/i18n/resource.properties,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -r1.9 -r1.9.2.1 --- resource.properties 26 Sep 2002 20:32:55 -0000 1.9 +++ resource.properties 3 Oct 2002 15:00:54 -0000 1.9.2.1 @@ -1031,3 +1031,5 @@ unmatchedOp=Binding operation has no corresponding portType operation: name = {0}, input name = {1}, output name = {2} noOperationForQName=Couldn't find an appropriate operation for XML QName {0} noParmDesc=operation description is missing parameter description! + +noBindingFault=ERROR: Unable to find fault "{0}" in operation "{1}", in binding {2}. \ No newline at end of file No revision No revision 1.44.2.2 +20 -7 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java Index: JavaTestCaseWriter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java,v retrieving revision 1.44.2.1 retrieving revision 1.44.2.2 diff -u -r1.44.2.1 -r1.44.2.2 --- JavaTestCaseWriter.java 1 Oct 2002 20:38:51 -0000 1.44.2.1 +++ JavaTestCaseWriter.java 3 Oct 2002 15:00:55 -0000 1.44.2.2 @@ -180,15 +180,23 @@ String javaOpName = Utils.xmlNameToJavaClass(op.getName()); String testMethodName = "test" + counter++ + portName + javaOpName; - pw.println(" public void " + testMethodName + "() {"); + pw.println(" public void " + testMethodName + "() throws Exception {"); String bindingType = (String) bEntry.getDynamicVar(JavaBindingWriter.INTERFACE_NAME); writeBindingAssignment(pw, bindingType, portName); - pw.println(" try {"); + + pw.println(" // Test operation"); + String indent = ""; + Map faultMap = op.getFaults(); + if (faultMap != null && faultMap.size() > 0) { + // we are going to catch fault Exceptions + pw.println(" try {"); + indent = " "; + } if (params.returnParam != null) { TypeEntry returnType = params.returnParam.getType(); - pw.print(" "); + pw.print(" " + indent); pw.print(Utils.getParameterTypeName(params.returnParam)); pw.print(" value = "); @@ -204,7 +212,7 @@ } } - pw.print(" "); + pw.print (" " + indent); if (params.returnParam != null) { pw.print("value = "); @@ -246,9 +254,9 @@ pw.println(");"); - pw.println(" }"); - - Map faultMap = op.getFaults(); + if (faultMap != null && faultMap.size() > 0) { + pw.println(" }"); + } if (faultMap != null) { Iterator i = faultMap.values().iterator(); @@ -265,6 +273,10 @@ pw.println(" }"); } } + + pw.println(" " + indent + "// TBD - validate results"); + + /* pw.println(" catch (java.rmi.RemoteException re) {"); pw.print(" "); pw.println("throw new junit.framework.AssertionFailedError(\"Remote Exception caught: \" + re);"); @@ -274,6 +286,7 @@ pw.println(" // Unsigned constructors can throw - ignore"); pw.println(" }"); } + */ pw.println(" }"); pw.println(); } 1.98.2.3 +13 -2 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java