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 Tom Jordahl <to...@macromedia.com> on 2002/08/27 23:21:48 UTC
RE: cvs commit: xml-axis/java/test/wsdl/types ComprehensiveTypes.
wsdl VerifyTestCase.java
+1
I can't tell you how much of a pain it is that we have types with constructors that throw...
--
Tom Jordahl
Macromedia Server Development
-----Original Message-----
From: butek@apache.org [mailto:butek@apache.org]
Sent: Tuesday, August 27, 2002 4:38 PM
To: xml-axis-cvs@apache.org
Subject: cvs commit: xml-axis/java/test/wsdl/types
ComprehensiveTypes.wsdl VerifyTestCase.java
butek 2002/08/27 13:38:14
Modified: java/src/org/apache/axis/wsdl/toJava JavaBeanWriter.java
java/test/wsdl/types ComprehensiveTypes.wsdl
VerifyTestCase.java
Log:
We failed on a type coming from WS-I, so I fixed WSDL2Java and added
a test.
Revision Changes Path
1.24 +14 -2 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.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- JavaBeanWriter.java 18 Aug 2002 14:19:50 -0000 1.23
+++ JavaBeanWriter.java 27 Aug 2002 20:38:13 -0000 1.24
@@ -413,12 +413,24 @@
pw.println(" public " + className + "(java.lang.String value) {");
// Make sure we wrap base types with its Object type
String wrapper = JavaUtils.getWrapper(simpleValueType);
+
if (wrapper != null) {
pw.println(" this.value = new " + wrapper +
"(value)." + simpleValueType + "Value();");
} else {
- pw.println(" this.value = new " +
- simpleValueType + "(value);");
+ String indent = " ";
+ if (simpleValueType.equals("org.apache.axis.types.URI")) {
+ pw.println(" try {");
+ pw.println(" this.value = new org.apache.axis.types.URI(value);");
+ pw.println(" }");
+ pw.println(" catch (org.apache.axis.types.URI.MalformedURIException mue) {");
+ pw.println(" this.value = new org.apache.axis.types.URI();");
+ pw.println(" }");
+ }
+ else {
+ pw.println(" this.value = new " +
+ simpleValueType + "(value);");
+ }
}
pw.println(" }");
pw.println();
1.38 +40 -2 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.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- ComprehensiveTypes.wsdl 26 Aug 2002 21:15:54 -0000 1.37
+++ ComprehensiveTypes.wsdl 27 Aug 2002 20:38:13 -0000 1.38
@@ -352,6 +352,15 @@
<xsd:element name="d" type="typens2:a" />
</xsd:sequence>
</xsd:complexType>
+
+ <!-- Test for a WS-I-like type that we used to fail on. -->
+ <xsd:complexType name="SimpleAnyURIType">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:anyURI">
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
</xsd:schema>
</types>
@@ -594,6 +603,16 @@
<part name="anyURI" type="xsd:anyURI"/>
</message>
+ <message name="inputSimpleAnyURI">
+ <part name="inAnyURI" type="typens2:SimpleAnyURIType"/>
+ <part name="anyURI" type="typens2:SimpleAnyURIType"/>
+ </message>
+
+ <message name="outputSimpleAnyURI">
+ <part name="outAnyURI" type="typens2:SimpleAnyURIType"/>
+ <part name="anyURI" type="typens2:SimpleAnyURIType"/>
+ </message>
+
<message name="inputYear">
<part name="inYear" type="xsd:gYear"/>
<part name="Year" type="xsd:gYear"/>
@@ -1067,11 +1086,15 @@
<operation name="methodUnsignedByte">
<input message="tns:inputUnsignedByte"/>
<output message="tns:outputUnsignedByte"/>
- </operation>
+ </operation>
<operation name="methodAnyURI">
<input message="tns:inputAnyURI"/>
<output message="tns:outputAnyURI"/>
- </operation>
+ </operation>
+ <operation name="methodSimpleAnyURI">
+ <input message="tns:inputSimpleAnyURI"/>
+ <output message="tns:outputSimpleAnyURI"/>
+ </operation>
<operation name="methodYear">
<input message="tns:inputYear"/>
<output message="tns:outputYear"/>
@@ -2202,6 +2225,21 @@
</output>
</operation>
<operation name="methodAnyURI">
+ <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>
+ </operation>
+ <operation name="methodSimpleAnyURI">
<soap:operation soapAction=""/>
<input>
<soap:body
1.31 +14 -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.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- VerifyTestCase.java 26 Aug 2002 21:15:54 -0000 1.30
+++ VerifyTestCase.java 27 Aug 2002 20:38:13 -0000 1.31
@@ -68,6 +68,8 @@
import test.wsdl.types.comprehensive_types.StringParameter;
import test.wsdl.types.comprehensive_types2.A;
import test.wsdl.types.comprehensive_types2.B;
+import test.wsdl.types.comprehensive_types2.SimpleAnyURIType;
+import test.wsdl.types.comprehensive_types2.holders.SimpleAnyURITypeHolder;
import test.wsdl.types.comprehensive_service.TypeTest;
import test.wsdl.types.comprehensive_service.TypeTestServiceLocator;
@@ -719,6 +721,18 @@
}
URIHolder ch = new URIHolder(sendValue);
URI actual = binding.methodAnyURI(sendValue, ch);
+ } catch (java.rmi.RemoteException re) {
+ throw new junit.framework.AssertionFailedError("methodAnyURI Exception caught: " + re );
+ }
+
+ try {
+ SimpleAnyURIType sendValue = null;
+ try {
+ sendValue = new SimpleAnyURIType("urn:this-is-a-simple-test");
+ } catch (Exception e) {
+ }
+ SimpleAnyURITypeHolder ch = new SimpleAnyURITypeHolder(sendValue);
+ SimpleAnyURIType actual = binding.methodSimpleAnyURI(sendValue, ch);
} catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("methodAnyURI Exception caught: " + re );
}