You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by am...@apache.org on 2007/04/04 07:34:54 UTC
svn commit: r525412 - in /webservices/axis2/trunk/java/modules:
adb-codegen/src/org/apache/axis2/schema/template/
kernel/src/org/apache/axis2/description/
kernel/src/org/apache/axis2/wsdl/util/
xmlbeans/src/org/apache/axis2/xmlbeans/
Author: amilas
Date: Tue Apr 3 22:34:53 2007
New Revision: 525412
URL: http://svn.apache.org/viewvc?view=rev&rev=525412
Log:
revert the wsdl imports as in the axis2 1.1.1 release
change the patchElement in xmlbeans codeGenerationUtility to remove the leading File.seperator
put a proper exception if no service found
changed the adb bean template to handle type attribute in there is no nsprefix
Modified:
webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAllAxisServicesBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDL4JImportedWSDLHelper.java
webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl?view=diff&rev=525412&r1=525411&r2=525412
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl Tue Apr 3 22:34:53 2007
@@ -2274,7 +2274,10 @@
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
- java.lang.String nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
+ java.lang.String nsPrefix = null;
+ if (fullTypeName.indexOf(":") > -1){
+ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
+ }
nsPrefix = nsPrefix==null?"":nsPrefix;
java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAllAxisServicesBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAllAxisServicesBuilder.java?view=diff&rev=525412&r1=525411&r2=525412
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAllAxisServicesBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAllAxisServicesBuilder.java Tue Apr 3 22:34:53 2007
@@ -86,21 +86,29 @@
return null; // can't go any further without the wsdl
}
- Iterator wsdlServIter = wsdl4jDefinition.getServices().values().iterator();
- // let the wsdlToservice builder to decide the port to generate binding
- portName = null;
- while (wsdlServIter.hasNext()) {
- Service service = (Service) wsdlServIter.next();
- // set the serviceName on the parent to setup call to populateService
- serviceName = service.getQName();
- this.axisService = new AxisService();
- // now that serviceName and portName are set, call up to the
- // parent class to populate this service.
- AxisService retAxisService = populateService();
- if (retAxisService != null) {
- axisServices.add(retAxisService);
+ if (wsdl4jDefinition.getServices().size() > 0) {
+ Iterator wsdlServIter = wsdl4jDefinition.getServices().values().iterator();
+ // let the wsdlToservice builder to decide the port to generate binding
+ portName = null;
+ while (wsdlServIter.hasNext()) {
+ Service service = (Service) wsdlServIter.next();
+ // set the serviceName on the parent to setup call to populateService
+ serviceName = service.getQName();
+ this.axisService = new AxisService();
+ // now that serviceName and portName are set, call up to the
+ // parent class to populate this service.
+ AxisService retAxisService = populateService();
+ if (retAxisService != null) {
+ axisServices.add(retAxisService);
+ }
}
+ } else {
+ throw new AxisFault("No service was not found in the WSDL at " +
+ wsdl4jDefinition.getDocumentBaseURI()
+ + " with targetnamespace "
+ + wsdl4jDefinition.getTargetNamespace());
}
+
if (log.isDebugEnabled()) {
log.debug("Exit: populateAllServices.");
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?view=diff&rev=525412&r1=525411&r2=525412
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Tue Apr 3 22:34:53 2007
@@ -371,6 +371,7 @@
private void populatePortType(PortType wsdl4jPortType) throws AxisFault {
List wsdl4jOperations = wsdl4jPortType.getOperations();
+
// Added to use in ?wsdl2 as the interface name
axisService.addParameter(new Parameter(WSDL2Constants.INTERFACE_LOCAL_NAME,
wsdl4jPortType.getQName().getLocalPart()));
@@ -424,6 +425,8 @@
PortType portType = wsdl4jDefinition.getPortType(wsdl4jBinding.getPortType().getQName());
+
+
for (Iterator iterator = wsdl4jBidingOperations.iterator(); iterator.hasNext();) {
axisBindingOperation = new AxisBindingOperation();
@@ -460,7 +463,7 @@
axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
if (isSetMessageQNames) {
- addQNameReference(axisInMessage, wsdl4jBindingOperation.getOperation(),
+ addQNameReference(axisInMessage, wsdl4jOperation,
wsdl4jBindingInput,
wrappableOperations.contains(wsdl4jBindingOperation));
}
@@ -485,7 +488,7 @@
axisBindingOutMessage, BINDING_OPERATION_OUTPUT);
if (isSetMessageQNames) {
- addQNameReference(axisOutMessage, wsdl4jBindingOperation.getOperation(),
+ addQNameReference(axisOutMessage, wsdl4jOperation,
wsdl4jBindingOutput,
wrappableOperations.contains(wsdl4jBindingOperation));
}
@@ -551,7 +554,7 @@
}
// process the imports
- WSDL4JImportedWSDLHelper.processImports(wsdl4jDefinition);
+ WSDL4JImportedWSDLHelper.processImports(wsdl4jDefinition, new ArrayList());
// Adding the policies in the Definition to the the PolicyRegistry
processPoliciesInDefintion(wsdl4jDefinition);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDL4JImportedWSDLHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDL4JImportedWSDLHelper.java?view=diff&rev=525412&r1=525411&r2=525412
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDL4JImportedWSDLHelper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/wsdl/util/WSDL4JImportedWSDLHelper.java Tue Apr 3 22:34:53 2007
@@ -40,117 +40,92 @@
*
* @param wsdl4JDefinition
*/
- public static void processImports(Definition wsdl4JDefinition) {
- if (isTraceEnabled) {
- log.trace("processImports: wsdl4JDefinition=" + wsdl4JDefinition);
- }
- Map imported_defs = new HashMap();
- getImportedDefinitions(wsdl4JDefinition, imported_defs);
-
-
- for (Iterator iterator = imported_defs.values().iterator(); iterator.hasNext();) {
- Definition imported_def = (Definition) iterator.next();
-
- Map def_namespaces = wsdl4JDefinition.getNamespaces();
- Map imported_def_namespaces = imported_def.getNamespaces();
-
- Object prefix;
-
-
- for (Iterator prefix_iterator = imported_def_namespaces.keySet().iterator();
- prefix_iterator.hasNext();) {
- prefix = prefix_iterator.next();
-
- if (!def_namespaces.containsKey(prefix)) {
- def_namespaces.put(prefix, imported_def_namespaces.get(prefix));
- }
- }
+ public static void processImports(Definition wsdl4JDefinition,
+ List processedDocuments) {
- // copy types
- Types imported_def_types = imported_def.getTypes();
+ Map wsdlImports = wsdl4JDefinition.getImports();
- if (imported_def_types != null) {
- Types def_types = wsdl4JDefinition.getTypes();
+ if (null != wsdlImports && !wsdlImports.isEmpty()) {
+ Collection importsCollection = wsdlImports.values();
+ for (Iterator iterator = importsCollection.iterator(); iterator
+ .hasNext();) {
+ Vector values = (Vector) iterator.next();
+ for (int i = 0; i < values.size(); i++) {
+ Import wsdlImport = (Import) values.elementAt(i);
+
+ if (wsdlImport.getDefinition() != null) {
+ Definition importedDef = wsdlImport.getDefinition();
+
+ if (importedDef != null) {
+ String key = importedDef.getDocumentBaseURI();
+ if (key == null) {
+ key = importedDef.getTargetNamespace();
+ }
+ // stop recursive imports!
+ if (processedDocuments.contains(key)) {
+ return;
+ }
+ processedDocuments.add(key);
+
+ processImports(importedDef,
+ processedDocuments);
+
+ // copy ns
+ Map namespaces = importedDef.getNamespaces();
+ Iterator keys = namespaces.keySet().iterator();
+ while (keys.hasNext()) {
+ Object key2 = keys.next();
+ if (!wsdl4JDefinition.getNamespaces()
+ .containsValue(namespaces.get(key2))) {
+ wsdl4JDefinition.getNamespaces().put(key2,
+ namespaces.get(key2));
+ }
+ }
+
+ wsdl4JDefinition.getNamespaces().putAll(namespaces);
+ // copy types
+ Types t = importedDef.getTypes();
+ if (t != null) {
+ List typesList = t.getExtensibilityElements();
+ for (int j = 0; j < typesList.size(); j++) {
+ Types types = wsdl4JDefinition.getTypes();
+ if (types == null) {
+ types = wsdl4JDefinition.createTypes();
+ wsdl4JDefinition.setTypes(types);
+ }
+ types.addExtensibilityElement((ExtensibilityElement) typesList
+ .get(j));
+
+ }
+ }
+
+ // add messages
+ Map messagesMap = importedDef.getMessages();
+ wsdl4JDefinition.getMessages().putAll(messagesMap);
+
+ // add portypes
+ Map porttypeMap = importedDef.getPortTypes();
+ wsdl4JDefinition.getPortTypes().putAll(porttypeMap);
+
+ // add bindings
+ Map bindingMap = importedDef.getBindings();
+ wsdl4JDefinition.getBindings().putAll(bindingMap);
+
+ // add services
+ Map serviceMap = importedDef.getServices();
+ wsdl4JDefinition.getServices().putAll(serviceMap);
+
+ List extElementList = importedDef
+ .getExtensibilityElements();
+ wsdl4JDefinition.getExtensibilityElements().addAll(
+ extElementList);
- if (def_types == null) {
- def_types = wsdl4JDefinition.createTypes();
- wsdl4JDefinition.setTypes(def_types);
- }
+ }
- for (Iterator types_iterator =
- imported_def_types.getExtensibilityElements().iterator();
- types_iterator.hasNext();) {
- // CHECKME
- def_types.addExtensibilityElement((ExtensibilityElement) types_iterator.next());
+ }
+ }
}
}
-
- // add messages
- wsdl4JDefinition.getMessages().putAll(imported_def.getMessages());
-
- // add portTypes
- wsdl4JDefinition.getPortTypes().putAll(imported_def.getPortTypes());
-
-
- // add bindings
- wsdl4JDefinition.getBindings().putAll(imported_def.getBindings());
-
- // add services
- wsdl4JDefinition.getServices().putAll(imported_def.getServices());
-
- // add ExtensibilityElements
- wsdl4JDefinition.getExtensibilityElements()
- .addAll(imported_def.getExtensibilityElements());
-
- }
-
- // after putting the imports we going to remove them to avoid any confilicts
- List importsList = new ArrayList();
- Map imports = wsdl4JDefinition.getImports();
- Import wsdlImport;
- Vector wsdlImportVector;
- for (Iterator importsVectorIter = imports.values().iterator(); importsVectorIter.hasNext();) {
- wsdlImportVector = (Vector) importsVectorIter.next();
- for (Iterator importsIter = wsdlImportVector.iterator(); importsIter.hasNext();) {
- wsdlImport = (Import) importsIter.next();
- importsList.add(wsdlImport);
- }
- }
-
- for (Iterator importsListIter = importsList.iterator();importsListIter.hasNext();){
- wsdlImport = (Import) importsListIter.next();
- wsdl4JDefinition.removeImport(wsdlImport);
}
- }
-
- private static void getImportedDefinitions(Definition definition, Map importedDefs) {
- Map wsdlImports = definition.getImports();
- Import wsdl_import;
- Definition imported_def;
- String import_def_key;
-
- for (Iterator iterator = wsdlImports.values().iterator(); iterator.hasNext();) {
- Vector imports = (Vector) iterator.next();
- Iterator iter2 = imports.iterator();
- while (iter2.hasNext()) {
- wsdl_import = (Import) iter2.next();
- if (isTraceEnabled) {
- log.trace("getImportedDefinitions: import uri=" + wsdl_import.getLocationURI());
- }
- imported_def = wsdl_import.getDefinition();
-
- import_def_key = imported_def.getDocumentBaseURI();
-
- if (import_def_key == null) {
- import_def_key = imported_def.getTargetNamespace();
- }
-
- if (!importedDefs.containsKey(import_def_key)) {
- importedDefs.put(import_def_key, imported_def);
- getImportedDefinitions(imported_def, importedDefs);
- }
- }
- }
- }
}
Modified: webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java?view=diff&rev=525412&r1=525411&r2=525412
==============================================================================
--- webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java (original)
+++ webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java Tue Apr 3 22:34:53 2007
@@ -597,7 +597,7 @@
for (Iterator iter = pathElementStack.iterator(); iter.hasNext();) {
pathBuilder.append(File.separator + iter.next());
}
- systemId = pathBuilder.toString();
+ systemId = pathBuilder.toString().substring(1);
log.info("Resolving schema with publicId [" + publicId + "] and systemId [" + systemId +
"]");
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org