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 rk...@apache.org on 2001/11/30 01:40:41 UTC
cvs commit: xml-axis/java/src/org/apache/axis/wsdlgen Emitter.java Namespaces.java
rkumar 01/11/29 16:40:41
Modified: java/src/org/apache/axis/wsdlgen Emitter.java
Namespaces.java
Log:
makeNamespace should return a DefaultNamespace when the class is not in a package.
That way all such classes populate the same namespace
At designtime, use serviceName and targetNamespace for the service and soap body in the bindings.
The runtime continues to use targetService for the soap body in the bindings.
Revision Changes Path
1.7 +28 -19 xml-axis/java/src/org/apache/axis/wsdlgen/Emitter.java
Index: Emitter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdlgen/Emitter.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Emitter.java 2001/11/29 22:36:07 1.6
+++ Emitter.java 2001/11/30 00:40:41 1.7
@@ -107,8 +107,8 @@
private String implNS;
private String locationUrl;
private String importUrl;
- private String serviceUrn;
- private String serviceName = null;
+ private String serviceName;
+ private String targetService = null;
private String description;
private TypeMappingRegistry reg;
private Namespaces namespaces;
@@ -232,6 +232,12 @@
if (encodingList == null) {
clsName = cls.getName();
clsName = clsName.substring(clsName.lastIndexOf('.') + 1);
+
+ if (getServiceName() == null) {
+ String name = cls.getName();
+ name = name.substring(name.lastIndexOf('.') + 1);
+ setServiceName(name);
+ }
encodingList = new ArrayList();
encodingList.add(Constants.URI_SOAP_ENC);
@@ -425,7 +431,10 @@
SOAPBody soapBody = new SOAPBody();
soapBody.setUse("encoded");
- soapBody.setNamespaceURI(serviceName);
+ if (targetService == null)
+ soapBody.setNamespaceURI(intfNS);
+ else
+ soapBody.setNamespaceURI(targetService);
soapBody.setEncodingStyles(encodingList);
bindingInput.addExtensibilityElement(soapBody);
@@ -671,32 +680,32 @@
* Returns the String representation of the service URN
* @return String representation of the service URN
*/
- public String getServiceUrn() {
- return serviceUrn;
+ public String getServiceName() {
+ return serviceName;
}
/**
* Set the String representation of the service URN
* @param serviceUrn the String representation of the service URN
*/
- public void setServiceUrn(String serviceUrn) {
- this.serviceUrn = serviceUrn;
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
}
/**
- * Returns the service name
- * @return the service name
+ * Returns the target service name
+ * @return the target service name
*/
- public String getServiceName() {
- return serviceName;
+ public String getTargetService() {
+ return targetService;
}
/**
- * Set the service name
- * @param serviceName the service name
+ * Set the target service name
+ * @param targetService the target service name
*/
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
+ public void setTargetService(String targetService) {
+ this.targetService = targetService;
}
/**
@@ -771,10 +780,10 @@
emitter.setServiceUrn(serviceUrn);
emitter.setDescription(description);
- String serviceName = msgContext.getTargetService();
- if ((serviceName == null) || ("JWSProcessor".equals(serviceName)))
- serviceName = "";
- emitter.setServiceName(serviceName);
+ String targetService = msgContext.getTargetService();
+ if ((targetService == null) || ("JWSProcessor".equals(targetService)))
+ targetService = "";
+ emitter.setTargetService(targetService);
emitter.setReg(msgContext.getTypeMappingRegistry());
Document doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(emitter.emit());
return doc;
1.3 +2 -0 xml-axis/java/src/org/apache/axis/wsdlgen/Namespaces.java
Index: Namespaces.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdlgen/Namespaces.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Namespaces.java 2001/11/28 12:08:11 1.2
+++ Namespaces.java 2001/11/30 00:40:41 1.3
@@ -192,6 +192,8 @@
* @return namespace namespace String
*/
public static String makeNamespace (String clsName, String protocol) {
+ if (clsName.lastIndexOf('.') == -1)
+ return protocol + "://" + "DefaultNamespace";
String packageName = clsName.substring(0, clsName.lastIndexOf('.'));
StringTokenizer st = new StringTokenizer( packageName, "." );
String[] words = new String[ st.countTokens() ];