diff options
Diffstat (limited to 'branches/sca-java-1.x/modules')
2 files changed, 29 insertions, 6 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 7f1d07618f..0399988bd9 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 @@ -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.x/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaInterface.java b/branches/sca-java-1.x/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.x/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaInterface.java +++ b/branches/sca-java-1.x/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); } |