You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/12/17 21:14:43 UTC
svn commit: r1818512 - in
/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel:
src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java
Author: veithen
Date: Sun Dec 17 21:14:43 2017
New Revision: 1818512
URL: http://svn.apache.org/viewvc?rev=1818512&view=rev
Log:
Apply patch for AXIS2-4091 provided by Antonio Andrade and Matt Fluet.
Modified:
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=1818512&r1=1818511&r2=1818512&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Sun Dec 17 21:14:43 2017
@@ -1760,6 +1760,11 @@ public class WSDL11ToAxisServiceBuilder
namespacePrefixMap,
boEntry);
+ // No wrapped element needs to be created
+ if (!boEntry.isWrappedInput()) {
+ continue;
+ }
+
elementDeclaration.appendChild(newComplexType);
String namespaceToUse = namespaceURI;
@@ -1849,6 +1854,12 @@ public class WSDL11ToAxisServiceBuilder
namespaceImportsMap,
namespacePrefixMap,
boEntry);
+
+ // No wrapped element needs to be created
+ if (!boEntry.isWrappedInput()) {
+ continue;
+ }
+
elementDeclaration.appendChild(newComplexType);
String namespaceToUse = namespaceURI;
@@ -2253,7 +2264,11 @@ public class WSDL11ToAxisServiceBuilder
"and use the type attribute.");
} else {
// The presense of an element means that a wrapper xsd element is not needed.
- boe.setWrappedOutput(false);
+ if (isOutMessage){
+ boe.setWrappedOutput(false);
+ } else {
+ boe.setWrappedInput(false);
+ }
if (log.isDebugEnabled()) {
log.debug("The binding operation " + bindingOperationName +
" references message part " +
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java?rev=1818512&r1=1818511&r2=1818512&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java Sun Dec 17 21:14:43 2017
@@ -21,9 +21,18 @@ package org.apache.axis2.description;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.HashSet;
import javax.xml.namespace.QName;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObject;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+
import junit.framework.TestCase;
public class WSDL11ToAxisServiceBuilderTest extends TestCase {
@@ -54,4 +63,45 @@ public class WSDL11ToAxisServiceBuilderT
in.close();
}
}
+
+ public void testNonDuplicatedElementsHttpBinding() throws Exception {
+ final String wsdlPath = "test-resources/wsdl/nonduplicatedElements.wsdl";
+ InputStream in = new FileInputStream(wsdlPath);
+ final String targetNamespace = "http://www.example.org";
+ final QName serviceName = new QName(targetNamespace, "FooService");
+ final String portName = "FooHttpGetPort";
+
+ AxisService service = new WSDL11ToAxisServiceBuilder(in, serviceName, portName).populateService();
+ List schemaDocuments = service.getSchema();
+ List duplicatedGlobalElements = findDuplicatedGlobalElements(schemaDocuments);
+ // NO duplicated element should exists
+ assertTrue("Duplicated global element declarations found in '" + wsdlPath,
+ duplicatedGlobalElements.isEmpty());
+ }
+
+ protected List findDuplicatedGlobalElements(List schemaDocuments) {
+ List duplicatedGlobalElementDeclarations = new ArrayList();
+ Set globalElementDeclarations = new HashSet();
+ // Iterate over all schema documents
+ for (int i = 0; i < schemaDocuments.size(); i++) {
+ XmlSchema schemaDocument = (XmlSchema)schemaDocuments.get(i);
+ XmlSchemaObjectCollection items = schemaDocument.getItems();
+ for (Iterator itemsIt = items.getIterator(); itemsIt.hasNext();) {
+ XmlSchemaObject xmlSchemaObject = (XmlSchemaObject)itemsIt.next();
+ // Check only XML schema elements
+ if (xmlSchemaObject instanceof XmlSchemaElement) {
+ QName elementName = ((XmlSchemaElement)xmlSchemaObject).getQName();
+ /* Was another element with the same name found in this or
+ other XML schema document? */
+ if (globalElementDeclarations.contains(elementName)) {
+ duplicatedGlobalElementDeclarations.add(elementName);
+ } else {
+ globalElementDeclarations.add(elementName);
+ }
+ }
+ }
+ }
+ return duplicatedGlobalElementDeclarations;
+ }
+
}