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/09/17 22:33:10 UTC
cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava JavaGeneratorFactory.java JavaFaultWriter.java
tomj 2002/09/17 13:33:10
Modified: java/src/org/apache/axis/wsdl/symbolTable SymbolTable.java
java/src/org/apache/axis/wsdl/toJava
JavaGeneratorFactory.java JavaFaultWriter.java
Log:
Revamp the way we unwrap element for operation signature back to
the previous style. Input and output parts are unwraped in the same
manner.
A new behavior to cover the JAX-RPC TCK: In the case where there might
be a signature:
void echo( StringHolder arg )
We now represent it as
string echo( string arg )
This also fixes bug 12312.
Revision Changes Path
1.35 +23 -42 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java
Index: SymbolTable.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- SymbolTable.java 13 Sep 2002 13:42:22 -0000 1.34
+++ SymbolTable.java 17 Sep 2002 20:33:10 -0000 1.35
@@ -1046,8 +1046,7 @@
input.getMessage().getOrderedParts(null),
literalInput,
operation.getName(),
- bindingEntry,
- false);
+ bindingEntry);
}
// Collect all the output parameters
@@ -1057,8 +1056,7 @@
output.getMessage().getOrderedParts(null),
literalOutput,
operation.getName(),
- bindingEntry,
- true); // output parts
+ bindingEntry);
}
if (parameterOrder != null) {
@@ -1158,12 +1156,23 @@
// then it's an inout parameter.
// Don't bother doing this if the parameters are wrapped since their
// names won't be the part names.
- if (outdex >= 0 && !wrapped) {
+
+ if (outdex >= 0) {
Parameter outParam = (Parameter)outputs.get(outdex);
if (p.getType().equals(outParam.getType())) {
- outputs.remove(outdex);
- p.setMode(Parameter.INOUT);
- ++parameters.inouts;
+
+ // Some special case logic for JAX-RPC, but also to make things
+ // nicer for the user.
+ // If we have a single output, always make it the return value
+ // instead of: void echo(StringHolder inout)
+ // Do this: string echo(string in)
+ if (wrapped && outputs.size() == 1) {
+ ++parameters.inputs;
+ } else {
+ outputs.remove(outdex);
+ p.setMode(Parameter.INOUT);
+ ++parameters.inouts;
+ }
} else {
// If we're here, we have both an input and an output
// part with the same name but different types.... guess
@@ -1222,10 +1231,8 @@
Collection parts,
boolean literal,
String opName,
- BindingEntry bindingEntry,
- boolean outputParts)
+ BindingEntry bindingEntry)
throws IOException {
- Iterator i = parts.iterator();
// Determine if there's only one element. For wrapped
// style, we normally only have 1 part which is an
@@ -1235,6 +1242,7 @@
// the operation, we can unwrap it.
int numberOfElements = 0;
boolean possiblyWrapped = false;
+ Iterator i = parts.iterator();
while (i.hasNext()) {
Part part = (Part) i.next();
if (part.getElementName() != null) {
@@ -1355,17 +1363,6 @@
wrapped = false;
}
- // More conditions for wrapped mode to track JAX-RPC RI behavior
- // If we are dealing with output parameters:
- // - wrapped operations "dig into" the structure of the returned element
- // and return the inner element type IF:
- // 1) there are no attributes on the "wrapper" element
- // 2) there is a single element inside the "wrapper" (the return type)
- //
- // - wrapped operations return a bean mapped to the entire return
- // element otherwise
-
-
// Get the nested type entries.
// TODO - If we are unable to represent any of the types in the
// element, we need to use SOAPElement/SOAPBodyElement.
@@ -1373,12 +1370,9 @@
Vector vTypes =
SchemaUtils.getContainedElementDeclarations(node, this);
- // IF we got the types entries and we didn't find attributes
- // AND either we are not doing output params OR
- // there is only one element in a wrapped output param
+ // IF we got the type entries and we didn't find attributes
// THEN use the things in this element as the parameters
- if (vTypes != null && wrapped &&
- (!outputParts) || (vTypes.size() <= 1 && outputParts)) {
+ if (vTypes != null && wrapped) {
// add the elements in this list
for (int j = 0; j < vTypes.size(); j++) {
ElementDecl elem = (ElementDecl) vTypes.elementAt(j);
@@ -1391,27 +1385,14 @@
}
} else {
// - we were unable to get the types OR
- // - we found attributes OR
- // - we are doing output parameters (and there is more than 1)
+ // - we found attributes
// so we can't use wrapped mode.
param.setName(partName);
if (typeName != null) {
param.setType(getType(typeName));
} else if (elementName != null) {
-
- // An ugly hack here to set the referenced flag on the
- // element and the anonymous type that the element defines
- // There must be a better way to get this done.
- Element element = getElement(elementName);
- element.setIsReferenced(true);
- QName anonQName = SchemaUtils.getElementAnonQName(element.getNode());
- if (anonQName != null) {
- TypeEntry anonType = getType(anonQName);
- anonType.setIsReferenced(true);
- }
-
- param.setType(element);
+ param.setType(getElement(elementName));
}
setMIMEType(param, bindingEntry == null ? null :
bindingEntry.getMIMEType(opName, partName));
1.24 +1 -1 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
Index: JavaGeneratorFactory.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- JavaGeneratorFactory.java 12 Sep 2002 17:09:26 -0000 1.23
+++ JavaGeneratorFactory.java 17 Sep 2002 20:33:10 -0000 1.24
@@ -485,7 +485,7 @@
fault.getMessage().getOrderedParts(null),
false,
fault.getName(),
- null, false);
+ null);
} catch (IOException e) {}
// Inspect each TypeEntry referenced in a Fault Message Part
1.14 +1 -1 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaFaultWriter.java
Index: JavaFaultWriter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaFaultWriter.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- JavaFaultWriter.java 23 Aug 2002 21:50:48 -0000 1.13
+++ JavaFaultWriter.java 17 Sep 2002 20:33:10 -0000 1.14
@@ -101,7 +101,7 @@
fault.getMessage().getOrderedParts(null),
false,
fault.getName(),
- null, false);
+ null);
// Write data members of the exception and getter methods for them
for (int i = 0; i < params.size(); i++) {