From d1c4adc36afab58063b5f9dbb9a754ca875b5e3e Mon Sep 17 00:00:00 2001 From: bdaniel Date: Thu, 28 Oct 2010 04:46:29 +0000 Subject: TUSCANY-3709 Do not aggregate schema types into facade WSDL, check local inline types before other WSDL documents, and update OASIS assembly test error messages git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1028182 13f79535-47bb-0310-9956-ffa450edef68 --- .../interfacedef/wsdl/impl/WSDLDefinitionImpl.java | 47 +++++++++++++++++++++- .../interfacedef/wsdl/xml/WSDLModelResolver.java | 2 +- 2 files changed, 46 insertions(+), 3 deletions(-) (limited to 'sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl') diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java index 5b3ad74229..dc3afaa641 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java @@ -219,7 +219,25 @@ public class WSDLDefinitionImpl implements WSDLDefinition { } } if (schemaCollection != null) { - return schemaCollection.getElementByQName(name); + XmlSchemaElement element = schemaCollection.getElementByQName(name); + if ( element != null) { + return element; + } + } + + for ( WSDLDefinition d: imported ) { + if ( d.getDefinition() == definition ) { + XmlSchemaElement element = d.getXmlSchemaElement(name); + if ( element != null ) + return element; + break; + } + } + + for ( WSDLDefinition d : imported ) { + XmlSchemaElement element = d.getXmlSchemaElement(name); + if ( element != null ) + return element; } return null; } @@ -239,7 +257,32 @@ public class WSDLDefinitionImpl implements WSDLDefinition { } } if (schemaCollection != null) { - return schemaCollection.getTypeByQName(name); + XmlSchemaType type = schemaCollection.getTypeByQName(name); + if ( type != null ) { + return type; + } + } + + // If this is an aggregated facade WSDL, the definition that this is intended to represent + // will be in the list of imports. We check for the type in this definition first before + // proceeding to any imports. + // TODO - This aggregated WSDL facade is a little strange and this isn't the most efficient + // way to handle this. For now, this resolves an issue where inline types are being + // returned from the wrong wsdl, but this could be improved. + for ( WSDLDefinition d: imported ) { + if ( d.getDefinition() == definition ) { + XmlSchemaType type = d.getXmlSchemaType(name); + if ( type != null ) + return type; + break; + } + } + + for ( WSDLDefinition d: imported ) { + XmlSchemaType type = d.getXmlSchemaType(name); + if ( type != null ) + return type; + break; } return null; } diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java index 6afa43b905..0e66c41a02 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java @@ -316,7 +316,7 @@ public class WSDLModelResolver implements ModelResolver { imp.setDefinition(d.getDefinition()); imp.setLocationURI(d.getDefinition().getDocumentBaseURI()); facade.addImport(imp); - aggregated.getXmlSchemas().addAll(d.getXmlSchemas()); + // aggregated.getXmlSchemas().addAll(d.getXmlSchemas()); aggregated.getImportedDefinitions().add(d); // Deal with extensibility elements in the imported Definitions... List extElements = (List) d.getDefinition().getExtensibilityElements(); -- cgit v1.2.3