tomj 2002/10/14 13:02:22 Modified: java/src/org/apache/axis/deployment/wsdd WSDDFault.java java/src/org/apache/axis/message SOAPFaultDetailsBuilder.java java/src/org/apache/axis/description ServiceDesc.java FaultDesc.java java/src/org/apache/axis/i18n resource.properties java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java java/src/org/apache/axis/wsdl/symbolTable FaultInfo.java Log: Continuation of previous submit of fromJava/emitter.java. Some improvements on generating WSDL from Java for faults. Now we actually generate reasonable fault information for the Group H fault interop services. Of particular note, I added a name= attirbute to the <fault> tag in WSDD. This allows us to round trip various names nicely. Revision Changes Path 1.3 +4 -0 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDFault.java Index: WSDDFault.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDFault.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- WSDDFault.java 8 Oct 2002 03:31:32 -0000 1.2 +++ WSDDFault.java 14 Oct 2002 20:02:21 -0000 1.3 @@ -84,6 +84,10 @@ desc = new FaultDesc(); + String nameStr = e.getAttribute(ATTR_NAME); + if (nameStr != null && !nameStr.equals("")) + desc.setName(nameStr); + String qNameStr = e.getAttribute(ATTR_QNAME); if (qNameStr != null && !qNameStr.equals("")) desc.setQName(XMLUtils.getQNameFromString(qNameStr, e)); 1.4 +6 -1 xml-axis/java/src/org/apache/axis/message/SOAPFaultDetailsBuilder.java Index: SOAPFaultDetailsBuilder.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPFaultDetailsBuilder.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- SOAPFaultDetailsBuilder.java 8 Oct 2002 03:31:33 -0000 1.3 +++ SOAPFaultDetailsBuilder.java 14 Oct 2002 20:02:21 -0000 1.4 @@ -111,7 +111,12 @@ FaultDesc faultDesc = op.getFaultByQName(qn); if (faultDesc != null) { // Set the class - builder.setFaultClass(faultDesc.getClass()); + try { + Class faultClass = ClassUtils.forName(faultDesc.getClassName()); + builder.setFaultClass(faultClass); + } catch (ClassNotFoundException e) { + // Just create an AxisFault, no custom exception + } builder.setWaiting(true); // register callback for the data, use the xmlType from fault info Deserializer dser = null; 1.67 +43 -12 xml-axis/java/src/org/apache/axis/description/ServiceDesc.java Index: ServiceDesc.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/ServiceDesc.java,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- ServiceDesc.java 9 Oct 2002 19:06:30 -0000 1.66 +++ ServiceDesc.java 14 Oct 2002 20:02:21 -0000 1.67 @@ -1157,26 +1157,57 @@ */ FaultDesc fault = operation.getFaultByClass(ex); + // If we didn't find one, create a new one if (fault == null) { - QName xmlType = tm.getTypeQName(ex); - // Create a single part with the dummy name "fault" - // that locates the complexType for this exception. + fault = new FaultDesc(); + } + + // Try to fil in any parts of the faultDesc that aren't there + + // XMLType + QName xmlType = fault.getXmlType(); + if (xmlType == null) { + fault.setXmlType(tm.getTypeQName(ex)); + } + + // Name and Class Name + String pkgAndClsName = ex.getName(); + if (fault.getClassName() == null) { + fault.setClassName(pkgAndClsName); + } + if (fault.getName() == null) { + String name = pkgAndClsName.substring( + pkgAndClsName.lastIndexOf('.') + 1, + pkgAndClsName.length()); + fault.setName(name); + } + + // Parameters + // We add a single parameter which points to the type + if (fault.getParameters() == null) { + if (xmlType == null) { + xmlType = tm.getTypeQName(ex); + } + QName qname = fault.getQName(); + if (qname == null) { + qname = new QName("", "fault"); + } ParameterDesc param = new ParameterDesc( - new QName("", "fault"), - ParameterDesc.IN, - xmlType); + qname, + ParameterDesc.IN, + xmlType); param.setJavaType(ex); ArrayList exceptionParams = new ArrayList(); exceptionParams.add(param); - - fault = new FaultDesc(); - String pkgAndClsName = ex.getName(); - fault.setName(pkgAndClsName); fault.setParameters(exceptionParams); - fault.setClassName(pkgAndClsName); - fault.setXmlType(xmlType); + } + + // QName + if (fault.getQName() == null) { + fault.setQName(new QName(pkgAndClsName)); } + // Add the fault to the operation operation.addFault(fault); } } 1.5 +3 -4 xml-axis/java/src/org/apache/axis/description/FaultDesc.java Index: FaultDesc.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/FaultDesc.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- FaultDesc.java 8 Oct 2002 03:31:32 -0000 1.4 +++ FaultDesc.java 14 Oct 2002 20:02:21 -0000 1.5 @@ -65,6 +65,7 @@ * @author Tom Jordahl ([EMAIL PROTECTED]) */ public class FaultDesc { + private String name; private QName qname; private ArrayList parameters; private String className; @@ -81,14 +82,12 @@ public String getName() { - if (qname != null) - return qname.getLocalPart(); - return null; + return name; } public void setName(String name) { - qname = new QName("", name); + this.name = name; } public ArrayList getParameters() { 1.16 +1 -1 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.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- resource.properties 10 Oct 2002 20:46:59 -0000 1.15 +++ resource.properties 14 Oct 2002 20:02:21 -0000 1.16 @@ -861,7 +861,7 @@ mustSpecifyReturnType=No returnType was specified to the Call object! You must call setReturnType() if you have called addParameter(). mustSpecifyParms=No parameters specified to the Call object! You must call addParameter() for all parameters if you have called setReturnType(). noElemOrType=Error: Message part {0} of operation {1} should have either an element or a type attribute -badTypeNode=Error: Missing type resolution for element {2}, in WSDL message part {0} of operation {1} +badTypeNode=Error: Missing type resolution for element {2}, in WSDL message part {0} of operation {1}. Hint: Try turning off 'wrapped' processing (--noWrapped). # NOTE: in noUse, do no translate "soap:operation", "binding operation", "use". noUse=The soap:operation for binding operation {0} must have a "use" attribute. 1.69 +1 -0 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java Index: JavaDeployWriter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java,v retrieving revision 1.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- JavaDeployWriter.java 9 Oct 2002 20:51:30 -0000 1.68 +++ JavaDeployWriter.java 14 Oct 2002 20:02:21 -0000 1.69 @@ -486,6 +486,7 @@ String className = Utils.getFullExceptionName( faultInfo.getMessage(), symbolTable); pw.print(" <fault"); + pw.print(" name=\"" + faultInfo.getName() + "\""); pw.print(" qname=\"" + Utils.genQNameAttributeString(faultQName, "fns") + "\""); pw.print(" class=\"" + className+ "\""); 1.3 +8 -2 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/FaultInfo.java Index: FaultInfo.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/FaultInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FaultInfo.java 10 Oct 2002 15:12:15 -0000 1.2 +++ FaultInfo.java 14 Oct 2002 20:02:22 -0000 1.3 @@ -82,6 +82,7 @@ private QName xmlType; private Use use; private QName qName; + private String name; /** * This constructor creates FaultInfo for a binding fault. @@ -98,6 +99,7 @@ this.message = fault.getMessage(); this.xmlType = getFaultType(symbolTable, getFaultPart()); this.use = use; + this.name = fault.getName(); Part part = getFaultPart(); if (part == null) { @@ -135,6 +137,8 @@ else { this.qName = part.getElementName(); } + this.name = qName.getLocalPart(); + } // ctor public Message getMessage() { @@ -165,10 +169,12 @@ } // getQName /** - * Convenience method for getting the local part of the QName. + * Return the name of the fault. + * This is the name= attribute from a portType fault + * or the localname of a header fault. */ public String getName() { - return qName == null ? null : qName.getLocalPart(); + return name; } // getName /**