tomj 2002/12/17 12:45:19
Modified: java/src/org/apache/axis/providers/java JavaProvider.java
java/src/org/apache/axis/wsdl/fromJava Emitter.java
Log:
Fix bug 15072 - Java2WSDL generates "wrong" service element name.
Back out the change for bug 13262 which set the service element name to be
the service name from the WSDD. In the general case, this is the class name
which is used by the portType. This makes WSDL2Java have to resolve a
name conflict and changes the class names to have _Service and _Port
appended to them.
This is a change from 1.0, which just figured out non-conflicting names in a
reasonable way.
Additionally, we provide an explicit (but probably undocumented) way to set
the service element name as a service parameter which addresses the problem
detailed in bug 13262:
<parameter name="alias" value="MyServiceElementName"/>
Also moved some code in the WSDL Emitter that figures out the class name
out of an if statement because this variable is used elsewhere.
Revision Changes Path
1.95 +5 -2
xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java
Index: JavaProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- JavaProvider.java 11 Dec 2002 22:38:21 -0000 1.94
+++ JavaProvider.java 17 Dec 2002 20:45:18 -0000 1.95
@@ -419,8 +419,11 @@
Emitter emitter = new Emitter();
- // Set the name for the target service.
- emitter.setServiceElementName(serviceDesc.getName());
+ // This seems like a good idea, but in fact isn't because the
+ // emitter will figure out a reasonable name (<classname>Service)
+ // for the WSDL service element name. We provide the 'alias'
+ // setting to explicitly set this name. See bug 13262 for more info.
+ //emitter.setServiceElementName(serviceDesc.getName());
// service alias may be provided if exact naming is required,
// otherwise Axis will name it according to the implementing class name
1.80 +3 -3 xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
Index: Emitter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- Emitter.java 11 Dec 2002 22:38:28 -0000 1.79
+++ Emitter.java 17 Dec 2002 20:45:19 -0000 1.80
@@ -504,11 +504,11 @@
}
if (encodingList == null) {
+ clsName = cls.getName();
+ clsName = clsName.substring(clsName.lastIndexOf('.') + 1);
+
// Default the portType name
if (getPortTypeName() == null) {
- clsName = cls.getName();
- clsName = clsName.substring(clsName.lastIndexOf('.') + 1);
-
setPortTypeName(clsName);
}