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 Tom Jordahl <to...@macromedia.com> on 2002/09/27 23:14:00 UTC

Merge fix for 12833 in to 1.0?

This fix is for a 1.0 Final targeted bug - 12833
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12833

I am inclined to merge it in to 1.0, but it does have a bit of a risk factor since it changes the way we treat wrapped services (e.g. .NET) output parameters and we don't have too many functional tests in this area.

Can people (Glen, Russell, Rich) really look a the code and assure me things will be OK?

--
Tom Jordahl
Macromedia Server Development



-----Original Message-----
From: tomj@apache.org [mailto:tomj@apache.org]
Sent: Friday, September 27, 2002 4:47 PM
To: xml-axis-cvs@apache.org
Subject: cvs commit: xml-axis/java/src/org/apache/axis/client Call.java


tomj        2002/09/27 13:46:33

  Modified:    java/src/org/apache/axis/wsdl/toJava JavaStubWriter.java
               java/src/org/apache/axis/client Call.java
  Log:
  Fix for bug 12883 - handle output only arguments correctly
  
  In the doc/lit/wrapped case, we can not count on the first
  parameter in the response always being the return value of the function.
  We need to look up the parameters by their QNames and match them
  to where they go.
  
  Fix:
  - In the stub, for the wrapped case only, set the QName of the return element.
  - In the Axis Call, add a new function setReturnQName()
  - When processing return parameters, if the returnQName is set, use it to
    find the return value instead of assumming the first parameter is the return.
  
  Revision  Changes    Path
  1.98      +10 -1     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.97
  retrieving revision 1.98
  diff -u -r1.97 -r1.98
  --- JavaStubWriter.java	26 Sep 2002 17:04:02 -0000	1.97
  +++ JavaStubWriter.java	27 Sep 2002 20:46:33 -0000	1.98
  @@ -613,7 +613,16 @@
               Map partsMap = operation.getOperation().getInput().getMessage().getParts();
               Part p = (Part)partsMap.values().iterator().next();
               QName q = p.getElementName();
  -            pw.println("        _call.setOperationName(new javax.xml.namespace.QName(\"" + q.getNamespaceURI() + "\", \"" + q.getLocalPart() + "\"));" );
  +            pw.println("        _call.setOperationName(" + Utils.getNewQName(q) + ");" );
  +            
  +            // Special return info for wrapped - the QName of the element
  +            // which is the return type
  +            if (parms.returnParam != null) {
  +                QName returnQName = parms.returnParam.getQName();
  +                if (returnQName != null) {
  +                    pw.println("        _call.setReturnQName(" + Utils.getNewQName(returnQName) + ");" );
  +                }
  +            }
           } else {
               QName elementQName = Utils.getOperationQName(operation);
               if (elementQName != null) {
  
  
  
  1.180     +30 -5     xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.179
  retrieving revision 1.180
  diff -u -r1.179 -r1.180
  --- Call.java	19 Sep 2002 20:32:56 -0000	1.179
  +++ Call.java	27 Sep 2002 20:46:33 -0000	1.180
  @@ -895,6 +895,14 @@
       }
   
       /**
  +     * Set the QName of the return element
  +     * 
  +     * NOT part of JAX-RPC
  +     */ 
  +    public void setReturnQName(QName qname) {
  +        operation.setReturnQName(qname);
  +    }
  +    /**
        * Sets the desired return Java Class.  This is a convenience method
        * which will cause the Call to automatically convert return values
        * into a desired class if possible.  For instance, we return object
  @@ -1894,10 +1902,18 @@
                   // GD 03/15/02 : We're now checking for invalid metadata
                   // config at the top of this method, so don't need to do it
                   // here.  Check for void return, though.
  +                boolean findReturnParam = false;
                   if (!XMLType.AXIS_VOID.equals(returnType)) {
  -                    RPCParam param = (RPCParam)resArgs.get(0);
  -                    result = param.getValue();
  -                    outParamStart = 1;
  +                    if (operation.getReturnQName() == null) {
  +                        // Assume the first param is the return
  +                        RPCParam param = (RPCParam)resArgs.get(0);
  +                        result = param.getValue();
  +                        outParamStart = 1;
  +                    } else {
  +                        // If the QName of the return value was given to us, look
  +                        // through the result arguments to find the right name
  +                        findReturnParam = true;
  +                    }
                   }
   
                   for (int i = outParamStart; i < resArgs.size(); i++) {
  @@ -1912,8 +1928,17 @@
                           value = JavaUtils.convert(value, javaType);
                       }
   
  -                    outParams.put(param.getQName(), value);
  -                    outParamsList.add(value);
  +                    // Check if this parameter is our return 
  +                    // otherwise just add it to our outputs
  +                    if (findReturnParam &&
  +                          operation.getReturnQName().equals(param.getQName())) {
  +                        // found it!
  +                        result = value;
  +                        findReturnParam = false;
  +                    } else {
  +                        outParams.put(param.getQName(), value);
  +                        outParamsList.add(value);
  +                    }
                   }
               }
           } else {