summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-11 12:08:34 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-11 12:08:34 +0000
commit1a4f6fd2b4c41d63c5c48780cc46cc07a2fd8915 (patch)
treebec89e6c01dc4179171192ab143b81edb0e2e851 /branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src
parentb08924d760b10b6095e40634d51d5c40b1923740 (diff)
Fix TUSCANY-3267 and TUSCANY-2757 (ensure wrapper elements have nillable=false)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@813790 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src')
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
index dd47d23f6b..4c63122eff 100644
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
+++ b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
@@ -78,6 +78,7 @@ import org.apache.ws.commons.schema.XmlSchemaException;
import org.apache.ws.commons.schema.utils.NamespaceMap;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -340,6 +341,29 @@ public class Interface2WSDLGenerator {
}
List<XSDefinition> xsDefinitions = helper.getSchemaDefinitions(xsdFactory, resolver, en.getValue());
for (XSDefinition xsDef: xsDefinitions) {
+ // TUSCANY-2757 and TUSCANY-3267 - flip global wrapper elements with nillable
+ // set true to be set to false. The JAXB RI seems to be generating this setting
+ // incorrectly according to the JAXB spec.
+ Document doc = xsDef.getDocument();
+ if (doc != null) {
+ NodeList nodes = doc.getFirstChild().getChildNodes();
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node aNode = nodes.item(i);
+ if (aNode.getLocalName() != null && aNode.getLocalName().equals("element")) {
+ NamedNodeMap attributes = aNode.getAttributes();
+ Node nameAttr = attributes.getNamedItem("name");
+ if (nameAttr != null) {
+ QName elementName = new QName(xsDef.getNamespace(), nameAttr.getNodeValue());
+ if (wrappers.containsKey(elementName)) {
+ Node nillable = attributes.getNamedItem("nillable");
+ if (nillable != null) {
+ nillable.setNodeValue("false");
+ }
+ }
+ }
+ }
+ }
+ }
addSchemaExtension(xsDef, schemaCollection, wsdlDefinition, definition);
}
}