diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-14 17:40:37 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-14 17:40:37 +0000 |
commit | f9ef92ed9b0d3801a986cf03ebf5016d294e0411 (patch) | |
tree | 5bdc81bd64b89dd3fe08a3fb75278ec2ff70f858 /branches/sca-java-1.5.1/modules/binding-ws-wsdlgen | |
parent | 659bd9e8ffa9d0dda46e5ebb0cfb6ebbef883b28 (diff) |
Merge fix for TUSCANY-3141 from 1.6-SNAPSHOT
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@793989 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.5.1/modules/binding-ws-wsdlgen')
2 files changed, 29 insertions, 6 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 7f1d07618f..0399988bd9 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 @@ -439,17 +439,30 @@ public class Interface2WSDLGenerator { if (!"".equals(nsURI)) { imp.setAttribute("namespace", nsURI); } - NodeList childNodes = schema.getChildNodes(); + // Scan all xs:import elements to match namespace + NodeList childNodes = schema.getElementsByTagNameNS(SCHEMA_NS, "import"); for (int i = 0; i < childNodes.getLength(); i++) { Node childNode = childNodes.item(i); if (childNode instanceof Element) { - schema.insertBefore(imp, childNode); - imp = null; - break; + String ns = ((Element)childNode).getAttributeNS(SCHEMA_NS, "namespace"); + if (nsURI.equals(ns)) { + // The xs:import with the same namespace has been declared + return; + } } } - if (imp != null) { + // Try to find the first node after the import elements + Node firstNodeAfterImport = null; + if (childNodes.getLength() > 0) { + firstNodeAfterImport = childNodes.item(childNodes.getLength() - 1).getNextSibling(); + } else { + firstNodeAfterImport = schema.getFirstChild(); + } + + if (firstNodeAfterImport == null) { schema.appendChild(imp); + } else { + schema.insertBefore(imp, firstNodeAfterImport); } } @@ -602,8 +615,8 @@ public class Interface2WSDLGenerator { outputMsg.addPart(generateWrapperPart(definition, op, helpers, wrappers, false)); } else { DataType outputType = op.getOutputType(); - outputMsg.addPart(generatePart(definition, outputType, "return")); if (outputType != null) { + outputMsg.addPart(generatePart(definition, outputType, "return")); elements = new ArrayList<ElementInfo>(); ElementInfo element = getElementInfo(outputType.getPhysical(), outputType, null, helpers); elements.add(element); diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaInterface.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaInterface.java index 9635d65f99..729ed9c146 100644 --- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaInterface.java +++ b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaInterface.java @@ -21,6 +21,8 @@ package org.apache.tuscany.sca.binding.ws.wsdlgen; import javax.jws.WebMethod; import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; +import javax.jws.soap.SOAPBinding.ParameterStyle; import org.osoa.sca.annotations.OneWay; import org.osoa.sca.annotations.Remotable; @@ -54,4 +56,12 @@ public interface TestJavaInterface { @WebMethod void m7(TestJavaClass info) throws TestFault; + + @WebMethod + @SOAPBinding(parameterStyle=ParameterStyle.BARE) + void m8(String str); + + @WebMethod + @SOAPBinding(parameterStyle=ParameterStyle.BARE) + int m9(String str); } |