butek 02/02/02 07:23:06
Modified: java/src/org/apache/axis/wsdl/toJava JavaWriterFactory.java
java/test/wsdl Wsdl2javaTestSuite.xml
Added: java/test/wsdl/clash clash.wsdl
Removed: java/test/clash AirportWeather.xml
Log:
Replace the existing clash test with a more comprehensive one and move it to the
wsdl directory. Also fix a bug this clash test found.
Revision Changes Path
1.9 +28 -13
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriterFactory.java
Index: JavaWriterFactory.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriterFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- JavaWriterFactory.java 24 Jan 2002 23:12:59 -0000 1.8
+++ JavaWriterFactory.java 2 Feb 2002 15:23:06 -0000 1.9
@@ -210,6 +210,7 @@
if (eType != null && eType.equals(e.getQName()))
resolve = false;
}
+
// Other Special Case:
// If the names are already different, no mangling is needed.
if (resolve) {
@@ -229,14 +230,14 @@
}
}
-
// Full Mangle if resolution is necessary.
if (resolve) {
boolean firstType = true;
for (int i = 0; i < v.size(); ++i) {
SymTabEntry entry = (SymTabEntry) v.elementAt(i);
if (entry instanceof Element) {
- entry.setName(mangleName(entry.getName() ,
"_ElemType"));
+ entry.setName(mangleName(entry.getName(),
+ "_ElemType"));
}
else if (entry instanceof TypeEntry) {
// Search all other types for java names that match
this one.
@@ -246,30 +247,44 @@
firstType = false;
Vector types = symbolTable.getTypes();
for (int j = 0; j < types.size(); ++j) {
- TypeEntry type = (TypeEntry) types.elementAt(j);
+ TypeEntry type = (TypeEntry)
+ types.elementAt(j);
if (type != entry &&
- !(type instanceof Element) &&
- type.getBaseType() == null &&
- sameJavaClass(((Type)entry).getName(),
type.getName())) {
+ !(type instanceof Element) &&
+ type.getBaseType() == null &&
+ sameJavaClass(
+ ((Type) entry).getName(),
+ type.getName())) {
v.add(type);
}
}
}
- entry.setName(mangleName(entry.getName() , "_Type"));
+ entry.setName(mangleName(entry.getName(), "_Type"));
}
else if (entry instanceof PortTypeEntry) {
- entry.setName(mangleName(entry.getName() , "_Port"));
+ entry.setName(mangleName(entry.getName(), "_Port"));
}
else if (entry instanceof ServiceEntry) {
- entry.setName(mangleName(entry.getName() , "_Service"));
+ entry.setName(mangleName(entry.getName(),
+ "_Service"));
}
// else if (entry instanceof MessageEntry) {
// we don't care about messages
// }
- // else if (entry instanceof BindingEntry) {
- // since files generated from bindings all append
strings to the name,
- // we don't care about bindings
- // }
+ else if (entry instanceof BindingEntry) {
+ BindingEntry bEntry = (BindingEntry) entry;
+
+ // If there is no literal use, then we never see a
+ // class named directly from the binding name. They
+ // all have suffixes: Stub, Skeleton, Impl.
+ // If there IS literal use, then the SDI will be
+ // named after the binding name, so there is the
+ // possibility of a name clash.
+ if (bEntry.hasLiteral()) {
+ entry.setName(mangleName(entry.getName(),
+ "_Binding"));
+ }
+ }
}
}
}
1.66 +3 -8 xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml
Index: Wsdl2javaTestSuite.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- Wsdl2javaTestSuite.xml 1 Feb 2002 18:04:09 -0000 1.65
+++ Wsdl2javaTestSuite.xml 2 Feb 2002 15:23:06 -0000 1.66
@@ -346,16 +346,11 @@
<mapping namespace="http://soapinterop.org/xsd"
package="mssoapinterop.interopc"/>
</wsdl2java>
- <!-- PortType/Service name clash test -->
- <wsdl2java url="test/clash/AirportWeather.xml"
+ <!-- Name clash test -->
+ <wsdl2java url="test/wsdl/clash/clash.wsdl"
output="build/work"
testcase="yes"
- deployscope="none"
- skeleton="yes"
- verbose="no"
- noimports="no">
- <mapping namespace="http://www.capeclear.com/AirportWeather.wsdl"
package="test.clash"/>
- <mapping namespace="http://www.capeclear.com/AirportWeather.xsd"
package="test.clash.types"/>
+ skeleton="yes">
</wsdl2java>
<!-- WSDL fault generation test -->
1.1 xml-axis/java/test/wsdl/clash/clash.wsdl
Index: clash.wsdl
===================================================================
<?xml version="1.0" ?>
<definitions
name="name clash test"
targetNamespace="clash.wsdl.test"
xmlns:tns="clash.wsdl.test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<!-- type defs -->
<types>
<xsd:schema targetNamespace="clash.wsdl.test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="sharedName">
<xsd:all>
<xsd:element name="sharedName" type="xsd:int"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
</types>
<!-- message declns -->
<message name="empty"/>
<message name="sharedName">
<part name="sharedName" type="tns:sharedName"/>
</message>
<!-- port type declns -->
<portType name="sharedName">
<operation name="sharedName">
<input name="sharedName" message="tns:empty"/>
<output name="sharedName" message="tns:sharedName"/>
</operation>
<!-- a bug in WSDL4J doesn't allow overloaded operations
<operation name="sharedName">
<input name="sharedName" message="tns:sharedName"/>
<output name="empty" message="tns:empty"/>
</operation>
<operation name="sharedName">
<input name="empty" message="tns:empty"/>
<output name="sharedName" message="tns:sharedName"/>
</operation>
-->
</portType>
<!-- binding declns -->
<binding name="nonSharedName" type="tns:sharedName">
<soap:binding
style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sharedName">
<input name="sharedName">
<soap:body use="encoded"/>
</input>
<output name="sharedName">
<soap:body use="encoded"/>
</output>
</operation>
<!-- a bug in WSDL4J doesn't allow overloaded operations
<operation name="sharedName">
<input name="sharedName">
<soap:body use="encoded"/>
</input>
<output name="empty">
<soap:body use="encoded"/>
</output>
</operation>
<operation name="sharedName">
<input name="empty">
<soap:body use="encoded"/>
</input>
<output name="sharedName">
<soap:body use="encoded"/>
</output>
</operation>
-->
</binding>
<binding name="sharedName" type="tns:sharedName">
<soap:binding
style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sharedName">
<input name="sharedName">
<soap:body use="literal"/>
</input>
<output name="sharedName">
<soap:body use="literal"/>
</output>
</operation>
<!-- a bug in WSDL4J doesn't allow overloaded operations
<operation name="sharedName">
<input name="sharedName">
<soap:body use="literal"/>
</input>
<output name="empty">
<soap:body use="encoded"/>
</output>
</operation>
<operation name="sharedName">
<input name="empty">
<soap:body use="encoded"/>
</input>
<output name="sharedName">
<soap:body use="encoded"/>
</output>
</operation>
-->
</binding>
<binding name="anotherNonSharedName" type="tns:sharedName">
<soap:binding
style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sharedName">
<input name="sharedName">
<soap:body use="encoded"/>
</input>
<output name="sharedName">
<soap:body use="encoded"/>
</output>
</operation>
<!-- a bug in WSDL4J doesn't allow overloaded operations
<operation name="sharedName">
<input name="sharedName">
<soap:body use="encoded"/>
</input>
<output name="empty">
<soap:body use="encoded"/>
</output>
</operation>
<operation name="sharedName">
<input name="empty">
<soap:body use="encoded"/>
</input>
<output name="sharedName">
<soap:body use="encoded"/>
</output>
</operation>
-->
</binding>
<!-- service decln -->
<service name="sharedName">
<port name="nonSharedName" binding="tns:nonSharedName">
<soap:address location="http://localhost:8080/axis/services/nonSharedName"/>
</port>
<port name="anotherNonSharedName" binding="tns:anotherNonSharedName">
<soap:address
location="http://localhost:8080/axis/services/anotherNonSharedName"/>
</port>
<port name="sharedName" binding="tns:sharedName">
<soap:address location="http://localhost:8080/axis/services/sharedName"/>
</port>
</service>
</definitions>