Hi Rich et al:
Hm. That's a well written commit message, and I'm really sorry you went through that rather long process. However... -1 (at least for now) I fixed the same bug as follows. Insert these three lines into Types.java at line 163: (I'd do this as a diff, but cvs.apache.org isn't accepting SSH connections at the moment for some reason) if (Holder.class.isAssignableFrom(type)) { type = JavaUtils.getHolderValueType(type); } Tests pass fine, and WSDL is generated correctly for INs, INOUTs, and OUTs. Since WSDL type emission is based on Java types, the writePartType() method is the place to do this check and make sure we always write the held type. Everything else works correctly as far as I can see. I agree re: the inconsistency in the ParameterDesc's JavaType - I think it should always be the Java Class of the actual parameter, so I also fixed the code around line 805 to do the right thing there (another 3 line fix). That was the only place I saw where it was inconsistent, and I think I put that code in because I didn't make the right fix in writePartType() myself during an earlier iteration. I didn't see the bug where OUT params weren't getting their JavaType set...? Also, I don't think isReturn() is necessary at all, since we already have accessors on the OperationDesc for the return information. End result - I would request that you roll back these changes on HEAD, and I'll go ahead and make the simpler fix on beta-3 and then merge it into HEAD later. --Glen > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 02, 2002 6:55 PM > To: [EMAIL PROTECTED] > Subject: cvs commit: xml-axis/java/test/wsdl/extensibility > ExtensibilityQueryBindingImpl.java > > > scheu 2002/07/02 15:54:33 > > Modified: java/src/org/apache/axis/description OperationDesc.java > ParameterDesc.java ServiceDesc.java > java/src/org/apache/axis/providers/java > RPCProvider.java > java/src/org/apache/axis/utils JavaUtils.java > axisNLS.properties > java/src/org/apache/axis/wsdl/fromJava Emitter.java > java/test/wsdl/extensibility > ExtensibilityQueryBindingImpl.java > Log: > This is the fix for defect Bugzilla Defect 10103 (also > reported by Sam) > > Problem: > Invoking echo?wsdl resulted in StringHolder and other > Holder elements in the > generated wsdl file. Holders should never appear in the > wsdl file, they are > java artifacts. > > This problem does not exist if the commandline Java2WSDL is used. > > Underlying Problem: > The deploy.wsdd for echo.wsdd contains a stanza that describes the > echoStructAsSimpleTypes operation. When this is loaded > in by the ServiceDesc, > the ParameterDesc javaType is not set correctly. > This eventually results in the indicated problem. > > Solution First Try: > Fixed bug in ServiceDesc. Now javaType is set for the > case where the ParameterDesc > for an OUT parameter is specified via the deploy.wsdd. > > This fixed the problem, but ran into other problems when > running functional-tests. > After analyzing ServiceDesc, I realized that the code is > not consistent for OUT and INOUT > parameters. Sometimes the javaType is set to the holder > and sometimes it is set to > the held type for the OUT/INOUT parameters. Sigh and yuck! > > Solution Second Try: > Made the executive decision that the ParameterDesc > javaType (if set) should always be > the heldType. Added code to ParameterDesc.setJavaType to > enforce this behaviour. Changed > ServiceDesc to set the javaType appropriately. Changed > RPCProvider as appropriate. Added > extra exception checks in RPCProvider. > > Even though this seemed like the correct approach, it > breaks down for OUT/INOUT arguments > that are arrays (i.e. String[] in the comprehensive > test). Under these circumstances it is > not possible to locate the holder class from the held > java type. (For arrays the name > of the holder is obtained from the name of the parameter > qname...for good reason that I won't go into > right now.) > > Solution Third Try: > Made the executive decision that the ParameterDesc > javaType (if set) should be a Holder if > the mode is OUT or INOUT, and should be a non-Holder if > the mode is IN. Changed > ParameterDesc.setJavaType() to enforce this decision. > Changed ServiceDesc to set/check the > javaType appropriately. Changed RPCHandler to get the > javaType correctly. Fixed > wsdl.toJava.Emitter to write out the held type. > > This almost worked...except that ParameterDesc is also > used to describe the return of > an OperationDesc. This cause problems because the mode > is not set correctly (it is set to IN) > and the javaType is not correct (if the mode is set to > OUT, the javaType should be a holder...but > this breaks because the return type is not a holder.) > > Solution Fourth Try: > Made the executive decision that the ParameterDesc > javaType should represent the java type in the > signature. This means that there needs to be a way to > designate that a ParameterDesc represents > a normal OUT parameter (which has a holder for its type) > or a return parameter (which also > should have a mode=OUT but does not use a holder). > > Aside: > I toyed with adding a new mode to ParameterDesc called > RET. But this doesn't seem appropriate when > you think that this model is re-used in WSDL2Java and > IN/OUT/INOUT are specific wsdl mode settings. > (Aside: Re-using models for dissimilar code is not always wise.) > > So I added an isReturn attribute to ParameterDesc to > indicate whether the ParameterDesc represents > a normal parameter or return. Changed the setJavaType to > respect this flag when determining > whether the argument javaType is acceptable. > OperationDesc was changed to set the ParameterDesc for > its return appropriately > (isReturn=true and mode=OUT). > > Also: > The logging churn caused a minor compile problem in the > extensibility test...which is also fixed. > > Revision Changes Path > 1.16 +4 -0 > xml-axis/java/src/org/apache/axis/description/OperationDesc.java > > Index: OperationDesc.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/description/Operat > ionDesc.java,v > retrieving revision 1.15 > retrieving revision 1.16 > diff -u -r1.15 -r1.16 > --- OperationDesc.java 2 Jul 2002 18:07:29 -0000 1.15 > +++ OperationDesc.java 2 Jul 2002 22:54:32 -0000 1.16 > @@ -108,6 +108,8 @@ > * Default constructor. > */ > public OperationDesc() { > + returnDesc.setMode(ParameterDesc.OUT); > + returnDesc.setIsReturn(true); > } > > /** > @@ -116,6 +118,8 @@ > public OperationDesc(String name, ParameterDesc [] > parameters, QName returnQName) { > this.name = name; > returnDesc.setQName(returnQName); > + returnDesc.setMode(ParameterDesc.OUT); > + returnDesc.setIsReturn(true); > for (int i = 0; i < parameters.length; i++) { > addParameter(parameters[i]); > } > > > > 1.12 +40 -0 > xml-axis/java/src/org/apache/axis/description/ParameterDesc.java > > Index: ParameterDesc.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/description/Parame > terDesc.java,v > retrieving revision 1.11 > retrieving revision 1.12 > diff -u -r1.11 -r1.12 > --- ParameterDesc.java 21 Jun 2002 14:48:38 -0000 1.11 > +++ ParameterDesc.java 2 Jul 2002 22:54:32 -0000 1.12 > @@ -87,6 +87,8 @@ > private Class javaType = null; > /** The order of this parameter (-1 indicates unordered) */ > private int order = -1; > + /** Indicates if this ParameterDesc represents a > return or normal parameter **/ > + private boolean isReturn = false; > > public ParameterDesc() { > } > @@ -121,6 +123,7 @@ > return "name: " + name > + "\ntypeEntry: " + typeEntry > + "\nmode: " + (mode == IN ? "IN" : mode > == INOUT ? "INOUT" : "OUT: " + "position:" + order) > + + "\nisReturn:" + isReturn > + "\ntypeQName: " + typeQName > + "\njavaType: " + javaType; > } // toString > @@ -180,11 +183,33 @@ > this.typeQName = typeQName; > } > > + /** > + * Get the java type (note that this is javaType in > the signature.) > + * @return Class javaType > + */ > public Class getJavaType() { > return javaType; > } > > + /** > + * Set the java type (note that this is javaType in > the signature.) > + * @return Class javaType > + */ > public void setJavaType(Class javaType) { > + // The javaType must match the mode. A Holder is > expected for OUT/INOUT > + // parameters that don't represent the return type. > + if (javaType != null) { > + if ((mode == IN || isReturn) && > + > javax.xml.rpc.holders.Holder.class.isAssignableFrom(javaType) || > + mode != IN && !isReturn && > + > !javax.xml.rpc.holders.Holder.class.isAssignableFrom(javaType)) { > + throw new IllegalArgumentException( > + JavaUtils.getMessage("setJavaTypeErr00", > + javaType.getName(), > + getModeAsString(mode))); > + } > + } > + > this.javaType = javaType; > } > > @@ -202,5 +227,20 @@ > > public void setOrder(int order) { > this.order = order; > + } > + > + /** > + * Indicates ParameterDesc represents return of OperationDesc > + * @return true if return parameter of OperationDesc > + */ > + public boolean getIsReturn() { > + return isReturn; > + } > + /** > + * Set to true to indicate return parameter of OperationDesc > + * @param value boolean that indicates if return > parameter of OperationDesc > + */ > + public void setIsReturn(boolean value) { > + isReturn = value; > } > } // class Parameter > > > > 1.35 +13 -11 > xml-axis/java/src/org/apache/axis/description/ServiceDesc.java > > Index: ServiceDesc.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/description/Servic > eDesc.java,v > retrieving revision 1.34 > retrieving revision 1.35 > diff -u -r1.34 -r1.35 > --- ServiceDesc.java 2 Jul 2002 18:07:29 -0000 1.34 > +++ ServiceDesc.java 2 Jul 2002 22:54:32 -0000 1.35 > @@ -477,17 +477,15 @@ > int j; > for (j = 0; j < paramTypes.length; j++) { > Class type = paramTypes[j]; > + Class heldType = type; > + if (Holder.class.isAssignableFrom(type)) { > + heldType = > JavaUtils.getHolderValueType(type); > + } > ParameterDesc param = oper.getParameter(j); > // If no type is specified, just use > the Java type > QName typeQName = param.getTypeQName(); > if (typeQName == null) { > - if (Holder.class.isAssignableFrom(type)) { > - typeQName = tm.getTypeQName( > - > JavaUtils.getHolderValueType(type)); > - } else { > - typeQName = tm.getTypeQName(type); > - } > - > + typeQName = tm.getTypeQName(heldType); > param.setJavaType(type); > param.setTypeQName(typeQName); > } else { > @@ -496,6 +494,10 @@ > // Use the specified javaType or get one > // from the type mapping registry. > Class paramClass = param.getJavaType(); > + if (paramClass != null && > + > JavaUtils.getHolderValueType(paramClass) != null) { > + paramClass = > JavaUtils.getHolderValueType(paramClass); > + } > if (paramClass == null) { > paramClass = > tm.getClassForQName(param.getTypeQName()); > } > @@ -503,9 +505,10 @@ > // This is a match if the > paramClass is somehow > // convertable to the "real" > parameter type. If not, > // break out of this loop. > - if > (!JavaUtils.isConvertable(paramClass, type)) > + if > (!JavaUtils.isConvertable(paramClass, heldType)) { > break; > - > + } > + > param.setJavaType(type); > } > } > @@ -805,12 +808,11 @@ > if (heldClass != null) { > paramDesc.setMode(ParameterDesc.INOUT); > paramDesc.setTypeQName(tm.getTypeQName(heldClass)); > - paramDesc.setJavaType(heldClass); > } else { > paramDesc.setMode(ParameterDesc.IN); > paramDesc.setTypeQName(tm.getTypeQName(type)); > - paramDesc.setJavaType(type); > } > + paramDesc.setJavaType(type); > operation.addParameter(paramDesc); > } > > > > > 1.73 +12 -3 > xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java > > Index: RPCProvider.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/RPC > Provider.java,v > retrieving revision 1.72 > retrieving revision 1.73 > diff -u -r1.72 -r1.73 > --- RPCProvider.java 2 Jul 2002 18:07:33 -0000 1.72 > +++ RPCProvider.java 2 Jul 2002 22:54:32 -0000 1.73 > @@ -219,8 +219,13 @@ > Object value = rpcParam.getValue(); > ParameterDesc paramDesc = rpcParam.getParamDesc(); > if (paramDesc != null && > paramDesc.getJavaType() != null) { > + > + // Get the type in the signature (java > type or its holder) > + Class sigType = paramDesc.getJavaType(); > + > + // Convert the value into the expected > type in the signature > value = JavaUtils.convert(value, > - paramDesc.getJavaType()); > + sigType); > rpcParam.setValue(value); > if (paramDesc.getMode() == ParameterDesc.INOUT) > outs.add(rpcParam); > @@ -247,7 +252,9 @@ > for (int i = 0; i < outParams.size(); i++) { > ParameterDesc param = > (ParameterDesc)outParams.get(i); > Class holderClass = param.getJavaType(); > - if (Holder.class.isAssignableFrom(holderClass)) { > + > + if (holderClass != null && > + Holder.class.isAssignableFrom(holderClass)) { > argValues[numArgs + i] = > holderClass.newInstance(); > // Store an RPCParam in the outs > collection so we > // have an easy and consistent way to > write these > @@ -255,7 +262,9 @@ > outs.add(new RPCParam(param.getQName(), > argValues[numArgs + i])); > } else { > - // !!! Throw a fault here? > + throw new > AxisFault(JavaUtils.getMessage("badOutParameter00", > + > "" + param.getQName(), > + > operation.getName())); > } > } > } > > > > 1.58 +0 -2 > xml-axis/java/src/org/apache/axis/utils/JavaUtils.java > > Index: JavaUtils.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/utils/JavaUtils.java,v > retrieving revision 1.57 > retrieving revision 1.58 > diff -u -r1.57 -r1.58 > --- JavaUtils.java 2 Jul 2002 18:07:34 -0000 1.57 > +++ JavaUtils.java 2 Jul 2002 22:54:32 -0000 1.58 > @@ -783,8 +783,6 @@ > return new String(sb); > } > > - > - > /** > * Determines if the Class is a Holder class. If so > returns Class of held type > * else returns null > > > > 1.22 +3 -0 > xml-axis/java/src/org/apache/axis/utils/axisNLS.properties > > Index: axisNLS.properties > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/utils/axisNLS.properties,v > retrieving revision 1.21 > retrieving revision 1.22 > diff -u -r1.21 -r1.22 > --- axisNLS.properties 1 Jul 2002 14:47:59 -0000 1.21 > +++ axisNLS.properties 2 Jul 2002 22:54:32 -0000 1.22 > @@ -937,3 +937,6 @@ > attach.DimeStreamError11=DIME stream closed getting type padding. > attach.DimeStreamBadType=DIME stream received bad type \"{0}\". > > +badOutParameter00=A holder could not be found or > constructed for the OUT parameter {0} of method {1}. > +setJavaTypeErr00=Illegal argument passed to > ParameterDesc.setJavaType. The java type {0} does not match > the mode {1} > + > > > > 1.48 +19 -4 > xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java > > Index: Emitter.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emit > ter.java,v > retrieving revision 1.47 > retrieving revision 1.48 > diff -u -r1.47 -r1.48 > --- Emitter.java 2 Jul 2002 20:15:56 -0000 1.47 > +++ Emitter.java 2 Jul 2002 22:54:32 -0000 1.48 > @@ -74,6 +74,7 @@ > import org.apache.axis.encoding.*; > import org.apache.axis.utils.ClassUtils; > import org.apache.axis.utils.XMLUtils; > +import org.apache.axis.utils.JavaUtils; > import org.w3c.dom.Document; > > > @@ -867,8 +868,9 @@ > retParam.setQName(desc.getReturnQName()); > } > retParam.setTypeQName(desc.getReturnType()); > - retParam.setJavaType(desc.getReturnClass()); > retParam.setMode(ParameterDesc.OUT); > + retParam.setIsReturn(true); > + retParam.setJavaType(desc.getReturnClass()); > writePartToMessage(def, msg, false, retParam); > > ArrayList parameters = desc.getParameters(); > @@ -948,20 +950,33 @@ > // If Request message, only continue if IN or INOUT > // If Response message, only continue if OUT or INOUT > if (request && > - param.getMode() == ParameterDesc.OUT) > + param.getMode() == ParameterDesc.OUT) { > return null; > + } > if (!request && > - param.getMode() == ParameterDesc.IN) > + param.getMode() == ParameterDesc.IN) { > return null; > + } > > // Create the Part > Part part = def.createPart(); > > + // Get the java type to represent in the wsdl > + // (if the mode is OUT or INOUT and this > + // parameter does not represent the return type, > + // the type held in the Holder is the one that should > + // be written.) > + Class javaType = param.getJavaType(); > + if (param.getMode() != ParameterDesc.IN && > + param.getIsReturn() == false) { > + javaType = JavaUtils.getHolderValueType(javaType); > + } > + > // Write the type representing the parameter type > QName elemQName = null; > if (mode != MODE_RPC) > elemQName = param.getQName(); > - QName typeQName = types.writePartType(param.getJavaType(), > + QName typeQName = types.writePartType(javaType, > elemQName); > if (mode == MODE_RPC) { > if (typeQName != null) { > > > > 1.8 +3 -0 > xml-axis/java/test/wsdl/extensibility/ExtensibilityQueryBindin > gImpl.java > > Index: ExtensibilityQueryBindingImpl.java > =================================================================== > RCS file: > /home/cvs/xml-axis/java/test/wsdl/extensibility/ExtensibilityQ > ueryBindingImpl.java,v > retrieving revision 1.7 > retrieving revision 1.8 > diff -u -r1.7 -r1.8 > --- ExtensibilityQueryBindingImpl.java 2 Jul 2002 > 18:07:36 -0000 1.7 > +++ ExtensibilityQueryBindingImpl.java 2 Jul 2002 > 22:54:33 -0000 1.8 > @@ -22,6 +22,9 @@ > import org.apache.axis.utils.XMLUtils; > import org.apache.axis.client.Call; > > +import org.apache.commons.logging.Log; > +import org.apache.commons.logging.LogFactory; > + > import org.w3c.dom.Element; > import org.w3c.dom.Document; > import org.w3c.dom.NodeList; > > > >