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 to...@apache.org on 2002/01/18 22:05:46 UTC
cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava SymbolTable.java JavaStubWriter.java
tomj 02/01/18 13:05:46
Modified: java/src/org/apache/axis/wsdl/toJava SymbolTable.java
JavaStubWriter.java
Log:
Improve handling of literal message parts.
- Do not emit the message types which we have expanded to the types in the schema.
- Use the parameters in the PortTypeEntry when collecting the types in the stub writer
(for bean mappings). This prevent duplicating the code in the symbol table
Revision Changes Path
1.14 +4 -0 xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java
Index: SymbolTable.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SymbolTable.java 16 Jan 2002 19:14:02 -0000 1.13
+++ SymbolTable.java 18 Jan 2002 21:05:46 -0000 1.14
@@ -975,6 +975,10 @@
if (vTypes != null) {
// add the elements in this list
v.addAll(vTypes);
+ // turn off generation of the element type
+ // XXX is there a better way to do this?
+ symbolTable.remove(elementName);
+ types.remove(e);
} else {
// XXX - This should be a SOAPElement/SOAPBodyElement
v.add(getElement(elementName));
1.19 +26 -56 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
Index: JavaStubWriter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- JavaStubWriter.java 18 Jan 2002 19:51:48 -0000 1.18
+++ JavaStubWriter.java 18 Jan 2002 21:05:46 -0000 1.19
@@ -336,11 +336,14 @@
HashSet types = new HashSet();
HashSet firstPassTypes = new HashSet();
+ PortTypeEntry pe = symbolTable.getPortTypeEntry(portType.getQName());
+
// Get all the types from all the operations
List operations = portType.getOperations();
for (int i = 0; i < operations.size(); ++i) {
- firstPassTypes.addAll(getTypesInOperation((Operation) operations.get(i)));
+ Operation op = (Operation) operations.get(i);
+ firstPassTypes.addAll(getTypesInOperation(op, pe));
}
// Extract those types which are complex types.
@@ -362,28 +365,22 @@
* This method returns a set of all the TypeEntry in a given Operation.
* The elements of the returned HashSet are TypeEntry.
*/
- private HashSet getTypesInOperation(Operation operation) {
+ private HashSet getTypesInOperation(Operation operation, PortTypeEntry portEntry) {
HashSet types = new HashSet();
Vector v = new Vector();
- // Collect all the input types
- Input input = operation.getInput();
-
- if (input != null) {
- partTypes(v,
- input.getMessage().getOrderedParts(null),
- (bEntry.getInputBodyType(operation) == BindingEntry.USE_LITERAL));
- }
-
- // Collect all the output types
- Output output = operation.getOutput();
-
- if (output != null) {
- partTypes(v,
- output.getMessage().getOrderedParts(null),
- (bEntry.getOutputBodyType(operation) == BindingEntry.USE_LITERAL));
- }
-
+ Parameters params = portEntry.getParameters(operation.getName());
+
+ // Loop over parameter types for this operation
+ for (int i=0; i < params.list.size(); i++) {
+ Parameter p = (Parameter) params.list.get(i);
+ v.add(p.type);
+ }
+
+ // Add the return type
+ if (params.returnType != null)
+ v.add(params.returnType);
+
// Collect all the types in faults
Map faults = operation.getFaults();
@@ -397,10 +394,10 @@
(bEntry.getFaultBodyType(operation, f.getName()) == BindingEntry.USE_LITERAL));
}
}
-
// Put all these types into a set. This operation eliminates all duplicates.
for (int i = 0; i < v.size(); i++)
types.add(v.get(i));
+
return types;
} // getTypesInOperation
@@ -412,45 +409,18 @@
while (i.hasNext()) {
Part part = (Part) i.next();
-
- QName qType;
- if (literal) {
+
+ QName qType = part.getTypeName();
+ if (qType != null) {
+ v.add(symbolTable.getType(qType));
+ } else {
qType = part.getElementName();
if (qType != null) {
- // Get the Element
- Element e = symbolTable.getElement((qType));
-
- // Get the nested type entries.
- // even indexes are TypeEntries, odd are names
- Vector vTypes = SchemaUtils.getComplexElementTypesAndNames(
- symbolTable.getTypeEntry(qType, true).getNode(),
- symbolTable);
-
- if (vTypes != null) {
- // add the typeEntries in this list
- for (int j = 0; j < vTypes.size(); j +=2) {
- v.add(vTypes.get(j));
- }
- } else {
- // XXX This should probably be a SOAPElement/SOAPBodyElement
- v.add(symbolTable.getElement(qType));
- }
- }
- } else {
- qType = part.getTypeName();
- if (qType == null) {
- qType = part.getElementName();
- if (qType != null) {
- v.add(symbolTable.getElement(qType));
- }
- }
- else {
- if (qType != null) {
- v.add(symbolTable.getType(qType));
- }
+ v.add(symbolTable.getElement(qType));
}
}
- }
+ } // while
+
} // partTypes
/**