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 Glen Daniels <gd...@macromedia.com> on 2002/08/26 15:38:53 UTC
RE: cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava Jav
aGeneratorFactory.java JavaFaultWriter.java
IMHO, SymbolTable should become a 'real' (i.e. with a complete implementation and generating a more appropriate object model) XML Schema parser, post-1.0.
--Glen
> -----Original Message-----
> From: butek@us.ibm.com [mailto:butek@us.ibm.com]
> Sent: Monday, August 26, 2002 8:12 AM
> To: axis-dev@xml.apache.org
> Subject: Re: cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava
> JavaGeneratorFactory.java JavaFaultWriter.java
>
>
> There's way too much wrapped logic in SymbolTable.
> SymbolTable is meant to
> be language-mapping agnostic. I realize it never was, but
> this just makes
> it worse. I'll work on moving the logic to wsdl/toJava
> somewhere. After
> 1.0.
>
> Russell Butek
> butek@us.ibm.com
>
>
> tomj@apache.org on 08/23/2002 04:50:49 PM
>
> Please respond to axis-dev@xml.apache.org
>
> To: xml-axis-cvs@apache.org
> cc:
> Subject: cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava
> JavaGeneratorFactory.java JavaFaultWriter.java
>
>
>
> tomj 2002/08/23 14:50:49
>
> Modified: java/src/org/apache/axis/wsdl/symbolTable
> SymbolTable.java
> java/src/org/apache/axis/wsdl/toJava
> JavaGeneratorFactory.java JavaFaultWriter.java
> Log:
> Update the wrapped literal logic when creating parameters
> for stubs to
> match the JAX-RPC RI way of doing things. In a nutshell:
>
> 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
>
> We need tests that test wrapped document/literal services, because I
> don't believe the functional tests cover this area at all.
> Since the .
> NET
> SalesRankAndPrice test went away, we don't test this stuff.. :-(
>
> Revision Changes Path
> 1.26 +58 -22 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.25
> retrieving revision 1.26
> diff -u -r1.25 -r1.26
> --- SymbolTable.java 18 Aug 2002 14:19:50 -0000 1.25
> +++ SymbolTable.java 23 Aug 2002 21:50:48 -0000 1.26
> @@ -1027,16 +1027,22 @@
> Input input = operation.getInput();
> if (input != null) {
> getParametersFromParts(inputs,
> - input.getMessage().getOrderedParts(null),
> - literalInput, operation.getName(),
> bindingEntry);
> + input.getMessage().
> getOrderedParts(null),
> + literalInput,
> + operation.getName(),
> + bindingEntry,
> + false);
> }
>
> // Collect all the output parameters
> Output output = operation.getOutput();
> if (output != null) {
> getParametersFromParts(outputs,
> - output.getMessage().getOrderedParts(null),
> - literalOutput, operation.getName(),
> bindingEntry);
> + output.getMessage().
> getOrderedParts(null),
> + literalOutput,
> + operation.getName(),
> + bindingEntry,
> + true); // output parts
> }
>
> if (parameterOrder != null) {
> @@ -1188,10 +1194,11 @@
> * each Part (shouldn't we call these "Parts" or something?)
> */
> public void getParametersFromParts(Vector v,
> - Collection parts,
> - boolean literal,
> - String opName,
> - BindingEntry
> bindingEntry)
> + Collection parts,
> + boolean literal,
> + String opName,
> + BindingEntry bindingEntry,
> + boolean outputParts)
> throws IOException {
> Iterator i = parts.iterator();
>
> @@ -1226,7 +1233,7 @@
> possiblyWrapped) {
> wrapped = true;
> }
> -
> +
> i = parts.iterator();
> while (i.hasNext()) {
> Parameter param = new Parameter();
> @@ -1235,8 +1242,10 @@
> QName typeName = part.getTypeName();
> String partName = part.getName();
>
> + // We're either:
> + // 1. encoded
> + // 2. literal & not wrapped.
> if (!literal || !wrapped || elementName == null) {
> - // We're either RPC or literal + not wrapped.
>
> param.setName(partName);
>
> @@ -1265,7 +1274,7 @@
> continue; // next part
> }
>
> - // flow to here means literal + wrapped!
> + // flow to here means wrapped literal !
>
> // See if we can map all the XML types to java(?) types
> // if we can, we use these as the types
> @@ -1320,6 +1329,17 @@
> 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.
> @@ -1327,9 +1347,12 @@
> Vector vTypes =
>
> SchemaUtils.getContainedElementDeclarations(node,
> this);
>
> - // if we got the types entries and we didn't
> find attributes
> - // use the things is this element as the parameters
> - if (vTypes != null && wrapped) {
> + // 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
> + // THEN use the things in this element as the
> parameters
> + if (vTypes != null && wrapped &&
> + (!outputParts) || (vTypes.size() == 1 &&
> outputParts)) {
> // add the elements in this list
> for (int j = 0; j < vTypes.size(); j++) {
> ElementDecl elem = (ElementDecl) vTypes.
> elementAt(j);
> @@ -1341,20 +1364,33 @@
> v.add(p);
> }
> } else {
> - // we were unable to get the types, or we found
> attributes so
> - // we can't use wrapped mode.
> - Parameter p = new Parameter();
> - p.setName(partName);
> + // - we were unable to get the types OR
> + // - we found attributes OR
> + // - we are doing output parameters (and
> there is more
> than 1)
> + // so we can't use wrapped mode.
> + param.setName(partName);
>
> if (typeName != null) {
> - p.setType(getType(typeName));
> + param.setType(getType(typeName));
> } else if (elementName != null) {
> - p.setType(getElement(elementName));
> +
> + // 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);
> }
> - setMIMEType(p, bindingEntry == null ? null :
> + setMIMEType(param, bindingEntry == null ? null :
> bindingEntry.getMIMEType(opName,
> partName));
>
> - v.add(p);
> + v.add(param);
> }
> } // while
>
>
>
>
> 1.19 +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.18
> retrieving revision 1.19
> diff -u -r1.18 -r1.19
> --- JavaGeneratorFactory.java 8 Aug 2002 15:17:11 -0000 1.18
> +++ JavaGeneratorFactory.java 23 Aug 2002 21:50:48 -0000 1.19
> @@ -459,7 +459,7 @@
> fault.getMessage().getOrderedParts(null),
> false,
> fault.getName(),
> - null);
> + null, false);
> } catch (IOException e) {}
>
> // Inspect each TypeEntry referenced in a Fault
> Message Part
>
>
>
> 1.13 +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.12
> retrieving revision 1.13
> diff -u -r1.12 -r1.13
> --- JavaFaultWriter.java 8 Aug 2002 15:17:11 -0000 1.12
> +++ JavaFaultWriter.java 23 Aug 2002 21:50:48 -0000 1.13
> @@ -101,7 +101,7 @@
> fault.getMessage().
> getOrderedParts(null),
> false,
> fault.getName(),
> - null);
> + null, false);
>
> // Write data members of the exception and getter
> methods for
> them
> for (int i = 0; i < params.size(); i++) {
>
>
>
>
>