summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-11 11:46:11 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-11 11:46:11 +0000
commite6902c8e970ff23cb01c0f26b76325d806a76a91 (patch)
tree085b1d0869fc323f5eaae3f16f449fd4b982b39a /branches/sca-java-1.x/modules
parenta58eb108cd29cb35745e671e09457f402fdf25e6 (diff)
Fix TUSCANY-3267 and TUSCANY-2757 (ensure wrapper elements have nillable=false)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@813785 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules')
-rw-r--r--branches/sca-java-1.x/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.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java b/branches/sca-java-1.x/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.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
+++ b/branches/sca-java-1.x/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);
}
}