You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2002/05/31 17:17:11 UTC
cvs commit: xml-axis/java/test/wsdl/types ComprehensiveTypes.wsdl VerifyTestCase.java
scheu 2002/05/31 08:17:11
Modified: java/src/org/apache/axis/wsdl/toJava JavaBeanWriter.java
java/test/wsdl/types ComprehensiveTypes.wsdl
VerifyTestCase.java
Log:
Fix for defect http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9257
If a complexType does not have any contained elements or attributes,
the fault class generated for the complexType cannot be compiled.
Added a simple fix to the JavaBeanWriter to only generate the
full constructor if there are actually elements/attributes to
pass in.
Changed the comprehensive test to add two new complexTypes,
emptyFault and emptyComplexType, which have no contained elements
or attributes. This addition validates the processing.
Revision Changes Path
1.15 +28 -27 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java
Index: JavaBeanWriter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- JavaBeanWriter.java 14 May 2002 23:46:34 -0000 1.14
+++ JavaBeanWriter.java 31 May 2002 15:17:10 -0000 1.15
@@ -373,37 +373,38 @@
// Now write the constructor signature
- pw.println(" public " + className + "(");
- for (int i=0; i<paramTypes.size(); i++) {
- pw.print(" " + paramTypes.elementAt(i) +
- " " + paramNames.elementAt(i));
- if ((i+1) < paramTypes.size()) {
- pw.println(",");
- } else {
- pw.println(") {");
- }
- }
-
- // Call the extended constructor to set inherited fields
- if (extendType != null) {
- pw.println(" super(");
- for (int j=0; j<localParams; j++) {
- pw.print(" " + paramNames.elementAt(j));
- if ((j+1) < localParams) {
+ if (paramTypes.size() > 0) {
+ pw.println(" public " + className + "(");
+ for (int i=0; i<paramTypes.size(); i++) {
+ pw.print(" " + paramTypes.elementAt(i) +
+ " " + paramNames.elementAt(i));
+ if ((i+1) < paramTypes.size()) {
pw.println(",");
} else {
- pw.println(");");
+ pw.println(") {");
}
- }
+ }
+
+ // Call the extended constructor to set inherited fields
+ if (extendType != null) {
+ pw.println(" super(");
+ for (int j=0; j<localParams; j++) {
+ pw.print(" " + paramNames.elementAt(j));
+ if ((j+1) < localParams) {
+ pw.println(",");
+ } else {
+ pw.println(");");
+ }
+ }
+ }
+ // Set local fields directly
+ for (int j=localParams; j<paramNames.size(); j++) {
+ pw.println(" this." + paramNames.elementAt(j) +
+ " = " + paramNames.elementAt(j)+ ";");
+ }
+ pw.println(" }");
+ pw.println();
}
- // Set local fields directly
- for (int j=localParams; j<paramNames.size(); j++) {
- pw.println(" this." + paramNames.elementAt(j) +
- " = " + paramNames.elementAt(j)+ ";");
- }
- pw.println(" }");
- pw.println();
-
}
/**
1.29 +108 -0 xml-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl
Index: ComprehensiveTypes.wsdl
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- ComprehensiveTypes.wsdl 26 May 2002 15:31:33 -0000 1.28
+++ ComprehensiveTypes.wsdl 31 May 2002 15:17:11 -0000 1.29
@@ -133,6 +133,14 @@
</xsd:sequence>
</xsd:complexType>
+ <xsd:complexType name="emptyFault">
+ <xsd:sequence />
+ </xsd:complexType>
+
+ <xsd:complexType name="emptyComplexType">
+ <xsd:sequence />
+ </xsd:complexType>
+
<xsd:simpleType name="simpleFwd">
<xsd:restriction base="typens:simple" />
</xsd:simpleType>
@@ -602,6 +610,14 @@
<part name="cat" type="typens:Cat"/>
</message>
+ <message name="emptyFault">
+ <part name="theFault" type="typens:emptyFault" />
+ </message>
+
+ <message name="emptyComplexType">
+ <part name="emptyComplexType" type="typens:emptyComplexType" />
+ </message>
+
<!-- port type declns -->
<portType name="TypeTest">
<operation name="allPrimitivesIn">
@@ -730,6 +746,26 @@
<input message="tns:empty"/>
<output message="tns:complexWComplex"/>
</operation>
+ <operation name="emptyComplexTypeIn" parameterOrder="emptyComplexType">
+ <input message="tns:emptyComplexType"/>
+ <output message="tns:empty"/>
+ <fault name="emptyFault" message="tns:emptyFault"/>
+ </operation>
+ <operation name="emptyComplexTypeInout" parameterOrder="emptyComplexType">
+ <input message="tns:emptyComplexType"/>
+ <output message="tns:emptyComplexType"/>
+ <fault name="emptyFault" message="tns:emptyFault"/>
+ </operation>
+ <operation name="emptyComplexTypeOut" parameterOrder="emptyComplexType">
+ <input message="tns:empty"/>
+ <output message="tns:emptyComplexType"/>
+ <fault name="emptyFault" message="tns:emptyFault"/>
+ </operation>
+ <operation name="emptyComplexTypeReturn">
+ <input message="tns:empty"/>
+ <output message="tns:emptyComplexType"/>
+ <fault name="emptyFault" message="tns:emptyFault"/>
+ </operation>
<operation name="anyIn">
<input message="tns:any"/>
<output message="tns:empty"/>
@@ -1345,6 +1381,78 @@
namespace=""
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
+ </operation>
+ <operation name="emptyComplexTypeIn">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body
+ use="encoded"
+ namespace=""
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body
+ use="encoded"
+ namespace=""
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ <fault>
+ <soap:fault name="emptyFault" use="encoded"/>
+ </fault>
+ </operation>
+ <operation name="emptyComplexTypeInout">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body
+ use="encoded"
+ namespace=""
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body
+ use="encoded"
+ namespace=""
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ <fault>
+ <soap:fault name="emptyFault" use="encoded"/>
+ </fault>
+ </operation>
+ <operation name="emptyComplexTypeOut">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body
+ use="encoded"
+ namespace=""
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body
+ use="encoded"
+ namespace=""
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ <fault>
+ <soap:fault name="emptyFault" use="encoded"/>
+ </fault>
+ </operation>
+ <operation name="emptyComplexTypeReturn">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body
+ use="encoded"
+ namespace=""
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body
+ use="encoded"
+ namespace=""
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ <fault>
+ <soap:fault name="emptyFault" use="encoded"/>
+ </fault>
</operation>
<operation name="anyIn">
<soap:operation soapAction=""/>
1.24 +27 -0 xml-axis/java/test/wsdl/types/VerifyTestCase.java
Index: VerifyTestCase.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/types/VerifyTestCase.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- VerifyTestCase.java 30 May 2002 23:46:04 -0000 1.23
+++ VerifyTestCase.java 31 May 2002 15:17:11 -0000 1.24
@@ -50,6 +50,9 @@
import test.wsdl.types.comprehensive_types.ComplexWComplexHolder;
import test.wsdl.types.comprehensive_types.ElemWComplex;
import test.wsdl.types.comprehensive_types.ElemWComplexHolder;
+import test.wsdl.types.comprehensive_types.EmptyComplexType;
+import test.wsdl.types.comprehensive_types.EmptyComplexTypeHolder;
+import test.wsdl.types.comprehensive_types.EmptyFault;
import test.wsdl.types.comprehensive_types.Enum;
import test.wsdl.types.comprehensive_types.EnumHolder;
import test.wsdl.types.comprehensive_types.EnumByte;
@@ -363,6 +366,30 @@
try {
ComplexWComplex value = null;
value = binding.complexWComplexReturn();
+ } catch (java.rmi.RemoteException re) {
+ throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
+ }
+ try {
+ EmptyComplexType value = new EmptyComplexType();
+ binding.emptyComplexTypeIn(value);
+ } catch (java.rmi.RemoteException re) {
+ throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
+ }
+ try {
+ EmptyComplexTypeHolder value = new EmptyComplexTypeHolder( new EmptyComplexType());
+ binding.emptyComplexTypeInout(value);
+ } catch (java.rmi.RemoteException re) {
+ throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
+ }
+ try {
+ EmptyComplexTypeHolder value = new EmptyComplexTypeHolder();
+ binding.emptyComplexTypeOut(value);
+ } catch (java.rmi.RemoteException re) {
+ throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
+ }
+ try {
+ EmptyComplexType value = null;
+ value = binding.emptyComplexTypeReturn();
} catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
}