summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-1.6/modules/binding-ws-wsdlgen
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-01-04 14:49:54 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-01-04 14:49:54 +0000
commit716e6eb792322caa12d39f6ec53610f5a787dc65 (patch)
tree1d40d4d57599eff18ec05cf5fc6dd74933c23a9f /sca-java-1.x/branches/sca-java-1.6/modules/binding-ws-wsdlgen
parentc4bd8a170182c859953f2f4ccabc6238a1fe81c7 (diff)
TUSCANY-3408 Generate referenced namespace shortname if it's not already present
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@895647 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.6/modules/binding-ws-wsdlgen')
-rw-r--r--sca-java-1.x/branches/sca-java-1.6/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java30
1 files changed, 27 insertions, 3 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.6/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java b/sca-java-1.x/branches/sca-java-1.6/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
index bfa882ebf7..98f7215928 100644
--- a/sca-java-1.x/branches/sca-java-1.6/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
+++ b/sca-java-1.x/branches/sca-java-1.6/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
@@ -549,7 +549,15 @@ public class Interface2WSDLGenerator {
defaultNamespaceSchema = xsDef;
}
}
- }
+ }
+
+ // useful for debugging DOM issues
+ //System.out.println("======================= Schema DOM Pre Merge=======================" );
+ //for (XSDefinition xsDef : wsdlDefinition.getXmlSchemas()) {
+ // if (xsDef.getDocument() != null) {
+ // printDOM(xsDef.getDocument());
+ // }
+ //}
// TUSCANY-3283 merge the no namespace schema into the default namespace schema
if (noNamespaceSchema != null && defaultNamespaceSchema != null){
@@ -558,11 +566,19 @@ public class Interface2WSDLGenerator {
// merge the schema with no namespace into the schema with the default namspace for this WSDL
mergeSchema(noNamespaceSchema, defaultNamespaceSchema, wsdlDefinition.getXmlSchemas());
+ // useful for debugging DOM issues
+ //System.out.println("======================= Schema DOM Post Merge=======================" );
+ //for (XSDefinition xsDef : wsdlDefinition.getXmlSchemas()) {
+ // if (xsDef.getDocument() != null) {
+ // printDOM(xsDef.getDocument());
+ // }
+ //}
+
schemaCollection = new XmlSchemaCollection();
defaultNamespaceSchema.setSchema(null);
defaultNamespaceSchema.setSchemaCollection(null);
loadXSD(schemaCollection, defaultNamespaceSchema);
- }
+ }
// push the schema into the WSDL
for (XSDefinition xsDef: wsdlDefinition.getXmlSchemas()){
@@ -570,7 +586,7 @@ public class Interface2WSDLGenerator {
}
// useful for debugging DOM issues
- //System.out.println("======================= Schema DOM =======================" );
+ //System.out.println("======================= Schema DOM Process End =======================" );
//for (XSDefinition xsDef : wsdlDefinition.getXmlSchemas()) {
// if (xsDef.getDocument() != null) {
// printDOM(xsDef.getDocument());
@@ -720,6 +736,14 @@ public class Interface2WSDLGenerator {
if (type != null &&
type.getNodeValue().equals(typeName)){
if (xsDef.getNamespace().equals(defaultNamespace)){
+ // double check that there is a "tns" namespace shortname specified
+ String tnsNamespace = refSchema.getDocumentElement().getAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:tns");
+
+ if (tnsNamespace == null ||
+ tnsNamespace.isEmpty()){
+ refSchema.getDocumentElement().setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:tns", defaultNamespace);
+ }
+
// just add "tns" in front of the type name as
// we have merged the type into this schema
type.setNodeValue("tns:" + type.getNodeValue());