scheu 02/02/18 09:11:49
Modified: java/src/org/apache/axis/utils resources.properties
java/src/org/apache/axis/wsdl Java2WSDL.java
java/src/org/apache/axis/wsdl/fromJava Emitter.java
java/test/wsdl Java2WsdlAntTask.java
Log:
Following option changes to Java2WSDL
--service option is changed to --servicePortName
--serviceElementName option is added
--portTypeName option is added
Corresponding changes to Emitter getter and setter code.
See the help message for details on how these options affect
the wsdl element names.
Revision Changes Path
1.54 +5 -3 xml-axis/java/src/org/apache/axis/utils/resources.properties
Index: resources.properties
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/resources.properties,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- resources.properties 12 Feb 2002 18:33:56 -0000 1.53
+++ resources.properties 18 Feb 2002 17:11:48 -0000 1.54
@@ -599,11 +599,13 @@
j2wemitter00=emitter
j2wusage00=Usage: {0}
j2woptions00=Options:
-j2wdetails00=Details:\n portType name= <class-of-portType name>\n binding
name= <--service value>SoapBinding\n service name= <--service value> OR IF
CONFLICT WITH portType name: <--service value>Service\n port name= <--service
value>\n address location= <--location value>
+j2wdetails00=Details:\n portType element name= <--portTypeName value> OR
<class-of-portType name>\n binding element name= <--servicePortName
value>SoapBinding\n service element name= <--serviceElementName value> OR
<--portTypeName value>Service \n port element name= <--servicePortName value>\n
address location = <--location value>
j2wopthelp00=print this message and exit
j2woptoutput00=output Wsdl filename
j2woptlocation00=service location url
-j2woptservice00=service name (obtained from --location if not specified)
+j2woptportTypeName00=portType name (obtained from class-of-portType if not
specified)
+j2woptservicePortName00=service port name (obtained from --location if not
specified)
+j2woptserviceElementName00=service element name (defaults to --servicePortName
value + "Service")
j2woptnamespace00=target namespace
j2woptPkgtoNS00=package=namespace, name value pairs
j2woptmethods00=space or comma separated list of methods to export
@@ -639,4 +641,4 @@
badProp01=Bad property. {0} should be {1}; but it is {2}.
badProp02=Cannot set {0} property when {1} property is not {2}.
-literalTypePart00=Error: Message part {0} of operation or fault {1} is specified as
a type and the soap:body use of binding "{2}" is literal. This WSDL is not currently
supported.
\ No newline at end of file
+literalTypePart00=Error: Message part {0} of operation or fault {1} is specified as
a type and the soap:body use of binding "{2}" is literal. This WSDL is not currently
supported.
1.8 +20 -6 xml-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java
Index: Java2WSDL.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Java2WSDL.java 1 Feb 2002 22:46:13 -0000 1.7
+++ Java2WSDL.java 18 Feb 2002 17:11:49 -0000 1.8
@@ -81,7 +81,9 @@
protected static final int PACKAGE_OPT = 'p';
protected static final int NAMESPACE_OPT = 'n';
protected static final int NAMESPACE_IMPL_OPT = 'N';
- protected static final int SERVICE_NAME_OPT = 's';
+ protected static final int PORTTYPE_NAME_OPT = 'P';
+ protected static final int SERVICE_ELEMENT_NAME_OPT = 'S';
+ protected static final int SERVICE_PORT_NAME_OPT = 's';
protected static final int LOCATION_OPT = 'l';
protected static final int LOCATION_IMPORT_OPT = 'L';
protected static final int METHODS_ALLOWED_OPT = 'm';
@@ -113,10 +115,18 @@
CLOptionDescriptor.ARGUMENT_REQUIRED,
LOCATION_OPT,
JavaUtils.getMessage("j2woptlocation00")),
- new CLOptionDescriptor("service",
+ new CLOptionDescriptor("portTypeName",
CLOptionDescriptor.ARGUMENT_REQUIRED,
- SERVICE_NAME_OPT,
- JavaUtils.getMessage("j2woptservice00")),
+ PORTTYPE_NAME_OPT,
+ JavaUtils.getMessage("j2woptportTypeName00")),
+ new CLOptionDescriptor("serviceElementName",
+ CLOptionDescriptor.ARGUMENT_REQUIRED,
+ SERVICE_ELEMENT_NAME_OPT,
+ JavaUtils.getMessage("j2woptserviceElementName00")),
+ new CLOptionDescriptor("servicePortName",
+ CLOptionDescriptor.ARGUMENT_REQUIRED,
+ SERVICE_PORT_NAME_OPT,
+ JavaUtils.getMessage("j2woptservicePortName00")),
new CLOptionDescriptor("namespace",
CLOptionDescriptor.ARGUMENT_REQUIRED,
NAMESPACE_OPT,
@@ -267,8 +277,12 @@
emitter.setImplNamespace(option.getArgument());
break;
- case SERVICE_NAME_OPT:
- emitter.setServiceName(option.getArgument());
+ case SERVICE_ELEMENT_NAME_OPT:
+ emitter.setServiceElementName(option.getArgument());
+ break;
+
+ case SERVICE_PORT_NAME_OPT:
+ emitter.setServicePortName(option.getArgument());
break;
case LOCATION_OPT:
1.17 +79 -39 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.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Emitter.java 14 Feb 2002 20:56:46 -0000 1.16
+++ Emitter.java 18 Feb 2002 17:11:49 -0000 1.17
@@ -127,7 +127,8 @@
private String implNS;
private String locationUrl;
private String importUrl;
- private String serviceName;
+ private String servicePortName;
+ private String serviceElementName;
private String targetService = null;
private String description;
private TypeMapping tm = null; // Registered type mapping
@@ -135,9 +136,10 @@
private Namespaces namespaces;
private ArrayList encodingList;
- private Types types;
+ private Types types;
private String clsName;
-
+ private String portTypeName;
+
private Java2WSDLFactory factory; // Factory for obtaining user extensions
/**
@@ -164,10 +166,10 @@
// Supply reasonable file names if not supplied
if (filename1 == null) {
- filename1 = getServiceName() + "_interface.wsdl";
+ filename1 = getServicePortName() + "_interface.wsdl";
}
if (filename2 == null) {
- filename2 = getServiceName() + "_implementation.wsdl";
+ filename2 = getServicePortName() + "_implementation.wsdl";
}
// Write out the interface def
@@ -265,7 +267,7 @@
// Supply a reasonable file name if not supplied
if (filename == null) {
- filename = getServiceName();
+ filename = getServicePortName();
switch (mode) {
case MODE_ALL:
filename +=".wsdl";
@@ -360,8 +362,18 @@
clsName = cls.getName();
clsName = clsName.substring(clsName.lastIndexOf('.') + 1);
- // If service name is null, construct it from location or className
- if (getServiceName() == null) {
+ // Default the portType name
+ if (getPortTypeName() == null) {
+ setPortTypeName(clsName);
+ }
+
+ // Default the serviceElementName
+ if (getServiceElementName() == null) {
+ setServiceElementName(getPortTypeName() + "Service");
+ }
+
+ // If service port name is null, construct it from location or className
+ if (getServicePortName() == null) {
String name = getLocationUrl();
if (name != null) {
if (name.lastIndexOf('/') > 0) {
@@ -380,7 +392,7 @@
if (name == null || name.equals("")) {
name = clsName;
}
- setServiceName(name);
+ setServicePortName(name);
}
encodingList = new ArrayList();
@@ -470,7 +482,7 @@
Binding binding = def.createBinding();
binding.setUndefined(false);
binding.setQName(
- new javax.wsdl.QName(intfNS, getServiceName() + "SoapBinding"));
+ new javax.wsdl.QName(intfNS, getServicePortName() + "SoapBinding"));
SOAPBinding soapBinding = new SOAPBindingImpl();
soapBinding.setStyle("rpc");
@@ -495,13 +507,9 @@
Service service = def.createService();
- if (getServiceName().equals(clsName)) {
- service.setQName(
- new javax.wsdl.QName(implNS, getServiceName() + "Service"));
- } else {
- service.setQName(
- new javax.wsdl.QName(implNS, getServiceName()));
- }
+ service.setQName(new javax.wsdl.QName(implNS,
+ getServiceElementName()));
+
def.addService(service);
Port port = def.createPort();
@@ -509,7 +517,7 @@
port.setBinding(binding);
// Probably should use the end of the location Url
- port.setName(getServiceName());
+ port.setName(getServicePortName());
SOAPAddress addr = new SOAPAddressImpl();
addr.setLocationURI(locationUrl);
@@ -532,7 +540,7 @@
portType.setUndefined(false);
// PortType name is the name of the class being processed
- portType.setQName(new javax.wsdl.QName(intfNS, clsName));
+ portType.setQName(new javax.wsdl.QName(intfNS, getPortTypeName()));
// Get a ClassRep representing the portType class,
// and get the list of MethodRep
@@ -820,20 +828,20 @@
/**
* Sets the <code>Class</code> to export.
* @param cls the <code>Class</code> to export
- * @param name service name
+ * @param name service location
*/
- public void setClsSmart(Class cls, String serviceName) {
+ public void setClsSmart(Class cls, String location) {
- if (cls == null || serviceName == null)
+ if (cls == null || location == null)
return;
- // Strip off \ and / from serviceName
- if (serviceName.lastIndexOf('/') > 0) {
- serviceName =
- serviceName.substring(serviceName.lastIndexOf('/') + 1);
- } else if (serviceName.lastIndexOf('\\') > 0) {
- serviceName =
- serviceName.substring(serviceName.lastIndexOf('\\') + 1);
+ // Strip off \ and / from location
+ if (location.lastIndexOf('/') > 0) {
+ location =
+ location.substring(location.lastIndexOf('/') + 1);
+ } else if (location.lastIndexOf('\\') > 0) {
+ location =
+ location.substring(location.lastIndexOf('\\') + 1);
}
// Get the constructors of the class
@@ -844,12 +852,12 @@
Class[] parms = constructors[i].getParameterTypes();
// If the constructor has a single parameter
// that is an interface which
- // matches the serviceName, then use this as the interface class.
+ // matches the location, then use this as the interface class.
if (parms.length == 1 &&
parms[0].isInterface() &&
parms[0].getName() != null &&
Types.getLocalNameFromFullName(
- parms[0].getName()).equals(serviceName)) {
+ parms[0].getName()).equals(location)) {
intf = parms[0];
}
}
@@ -1125,19 +1133,51 @@
}
/**
- * Returns the String representation of the service URN
- * @return String representation of the service URN
+ * Returns the String representation of the service port name
+ * @return String representation of the service port name
+ */
+ public String getServicePortName() {
+ return servicePortName;
+ }
+
+ /**
+ * Set the String representation of the service port name
+ * @param serviceUrn the String representation of the service port name
+ */
+ public void setServicePortName(String servicePortName) {
+ this.servicePortName = servicePortName;
+ }
+
+ /**
+ * Returns the String representation of the service element name
+ * @return String representation of the service element name
+ */
+ public String getServiceElementName() {
+ return serviceElementName;
+ }
+
+ /**
+ * Set the String representation of the service element name
+ * @param serviceUrn the String representation of the service element name
+ */
+ public void setServiceElementName(String serviceElementName) {
+ this.serviceElementName = serviceElementName;
+ }
+
+ /**
+ * Returns the String representation of the portType name
+ * @return String representation of the portType name
*/
- public String getServiceName() {
- return serviceName;
+ public String getPortTypeName() {
+ return portTypeName;
}
/**
- * Set the String representation of the service URN
- * @param serviceUrn the String representation of the service URN
+ * Set the String representation of the portType name
+ * @param serviceUrn the String representation of the portType name
*/
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
+ public void setPortTypeName(String portTypeName) {
+ this.portTypeName = portTypeName;
}
/**
1.8 +6 -6 xml-axis/java/test/wsdl/Java2WsdlAntTask.java
Index: Java2WsdlAntTask.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/Java2WsdlAntTask.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Java2WsdlAntTask.java 5 Feb 2002 19:36:31 -0000 1.7
+++ Java2WsdlAntTask.java 18 Feb 2002 17:11:49 -0000 1.8
@@ -75,7 +75,7 @@
private String location = "";
private String output = "." ;
private String className = "." ;
- private String service = null ;
+ private String servicePortName = null ;
private String implClass = null;
private String factory = null;
private boolean useInheritedMethods = false;
@@ -103,8 +103,8 @@
if (!namespaceMap.isEmpty()) {
emitter.setNamespaceMap(namespaceMap);
}
- if (service != null)
- emitter.setServiceName(service);
+ if (servicePortName != null)
+ emitter.setServicePortName(servicePortName);
log("Java2WSDL " + className, Project.MSG_INFO);
emitter.setCls(className);
if (implClass != null)
@@ -152,9 +152,9 @@
this.factory = parameter;
}
- // The setter for the "service" attribute
- public void setService(String parameter) {
- this.service = parameter;
+ // The setter for the "servicePortName" attribute
+ public void setServicePortName(String parameter) {
+ this.servicePortName = parameter;
}
// The setter for the "namespace" attribute