tomj        02/02/27 09:32:17

  Modified:    java/src/org/apache/axis/wsdl/toJava JavaStubWriter.java
               java/src/org/apache/axis/client Call.java
               java/src/org/apache/axis/message BodyBuilder.java
  Log:
  More document/literal changes to make interop tests work.
  
  Revision  Changes    Path
  1.36      +15 -3     
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.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- JavaStubWriter.java       27 Feb 2002 15:50:11 -0000      1.35
  +++ JavaStubWriter.java       27 Feb 2002 17:32:17 -0000      1.36
  @@ -402,9 +402,9 @@
               return;
           }
           
  -//        if (type instanceof Element) {
  -//            return;
  -//        }
  +        if (type instanceof Element) {
  +            return;
  +        }
           
           if ( firstSer ) {
               pw.println("            Class cls;" );
  @@ -467,7 +467,13 @@
           for (int i = 0; i < parms.list.size(); ++i) {
               Parameter p = (Parameter) parms.list.get(i);
   
  +            // We need to use the Qname of the actual type, not the QName of the 
element
               QName qn = p.type.getQName();
  +            if (p.type instanceof DefinedElement) {
  +                Node node = symbolTable.getTypeEntry(p.type.getQName(), 
true).getNode();
  +                qn = Utils.getNodeTypeRefQName(node, "type");
  +            }
  +
               String typeString = "new javax.xml.rpc.namespace.QName(\"" +
                       qn.getNamespaceURI() + "\", \"" +
                       qn.getLocalPart() + "\")";
  @@ -491,7 +497,13 @@
           }
           // set output type
           if (parms.returnType != null) {
  +            // We need to use the Qname of the actual type, not the QName of the 
element
               QName qn = parms.returnType.getQName();
  +            if (parms.returnType instanceof DefinedElement) {
  +                Node node = symbolTable.getTypeEntry(parms.returnType.getQName(), 
true).getNode();
  +                qn = Utils.getNodeTypeRefQName(node, "type");
  +            }
  +            
               String outputType = "new javax.xml.rpc.namespace.QName(\"" +
                   qn.getNamespaceURI() + "\", \"" +
                   qn.getLocalPart() + "\")";
  
  
  
  1.84      +51 -40    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.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- Call.java 27 Feb 2002 15:50:11 -0000      1.83
  +++ Call.java 27 Feb 2002 17:32:17 -0000      1.84
  @@ -1515,48 +1515,59 @@
   
           resMsg = msgContext.getResponseMessage();
           resEnv = (SOAPEnvelope)resMsg.getSOAPEnvelope();
  -        try {
  -            body = (RPCElement)resEnv.getFirstBody();
  -            resArgs = body.getParams();
  -        } catch (Exception e) {
  -            log.error(JavaUtils.getMessage("exception00"), e);
  -            throw AxisFault.makeFault(e);
  -        }
  -
  -        if (resArgs != null && resArgs.size() > 0) {
  -
  -            // If there is no return, then we start at index 0 to create the 
outParams Map.
  -            // If there IS a return, then we start with 1.
  -            int outParamStart = 0;
  -
  -            // If we have resArgs and the returnType is specified, then the first
  -            // resArgs is the return.  If we have resArgs and neither returnType
  -            // nor paramTypes are specified, then we assume that the caller is
  -            // following the non-JAX-RPC AXIS shortcut of not having to specify
  -            // the return, in which case we again assume the first resArgs is
  -            // the return.
  -            // NOTE 1:  the non-JAX-RPC AXIS shortcut allows a potential error
  -            // to escape notice.  If the caller IS NOT following the non-JAX-RPC
  -            // shortcut but instead intentionally leaves returnType and params
  -            // null (ie., a method that takes no parameters and returns nothing)
  -            // then, if we DO receive something it should be an error, but this
  -            // code passes it through.  The ideal solution here is to require
  -            // this caller to set the returnType to void, but there's no void
  -            // type in XML.
  -            // NOTE 2:  we should probably verify that the resArgs element
  -            // types match the expected returnType and paramTypes, but I'm not
  -            // sure how to do that since the resArgs value is a Java Object
  -            // and the returnType and paramTypes are QNames.
  -            if (returnType != null || paramTypes == null) {
  -                RPCParam param = (RPCParam)resArgs.get(0);
  -                result = param.getValue();
  -                outParamStart = 1;
  +        SOAPBodyElement bodyEl = resEnv.getFirstBody();
  +        if (bodyEl instanceof RPCElement) {
  +            try {
  +                resArgs = ((RPCElement) bodyEl).getParams();
  +            } catch (Exception e) {
  +                log.error(JavaUtils.getMessage("exception00"), e);
  +                throw AxisFault.makeFault(e);
               }
  -
  -            for (int i = outParamStart; i < resArgs.size(); i++) {
  -                RPCParam param = (RPCParam) resArgs.get(i);
  -                outParams.put(param.getName(), param.getValue());
  +            
  +            if (resArgs != null && resArgs.size() > 0) {
  +                
  +                // If there is no return, then we start at index 0 to create the 
outParams Map.
  +                // If there IS a return, then we start with 1.
  +                int outParamStart = 0;
  +                
  +                // If we have resArgs and the returnType is specified, then the 
first
  +                // resArgs is the return.  If we have resArgs and neither returnType
  +                // nor paramTypes are specified, then we assume that the caller is
  +                // following the non-JAX-RPC AXIS shortcut of not having to specify
  +                // the return, in which case we again assume the first resArgs is
  +                // the return.
  +                // NOTE 1:  the non-JAX-RPC AXIS shortcut allows a potential error
  +                // to escape notice.  If the caller IS NOT following the non-JAX-RPC
  +                // shortcut but instead intentionally leaves returnType and params
  +                // null (ie., a method that takes no parameters and returns nothing)
  +                // then, if we DO receive something it should be an error, but this
  +                // code passes it through.  The ideal solution here is to require
  +                // this caller to set the returnType to void, but there's no void
  +                // type in XML.
  +                // NOTE 2:  we should probably verify that the resArgs element
  +                // types match the expected returnType and paramTypes, but I'm not
  +                // sure how to do that since the resArgs value is a Java Object
  +                // and the returnType and paramTypes are QNames.
  +                if (returnType != null || paramTypes == null) {
  +                    RPCParam param = (RPCParam)resArgs.get(0);
  +                    result = param.getValue();
  +                    outParamStart = 1;
  +                }
  +                
  +                for (int i = outParamStart; i < resArgs.size(); i++) {
  +                    RPCParam param = (RPCParam) resArgs.get(i);
  +                    outParams.put(param.getName(), param.getValue());
  +                }
  +            }
  +        } else {
  +            // This is a SOAPBodyElement, try to treat it like a return value
  +            try {
  +                result = bodyEl.getValueAsType(returnType);
  +            } catch (Exception e) {
  +                // just return the SOAPElement
  +                result = bodyEl;
               }
  +
           }
   
           if (log.isDebugEnabled()) {
  
  
  
  1.20      +1 -1      xml-axis/java/src/org/apache/axis/message/BodyBuilder.java
  
  Index: BodyBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/BodyBuilder.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- BodyBuilder.java  22 Feb 2002 23:39:45 -0000      1.19
  +++ BodyBuilder.java  27 Feb 2002 17:32:17 -0000      1.20
  @@ -148,7 +148,7 @@
                                              context);
           } else if (!gotRPCElement &&
               isRoot && 
  -            msgContext.isPropertyTrue(MessageContext.ISRPC, true) ) {
  +            msgContext.isEncoded() ) {
                   gotRPCElement = true;
                   element = new RPCElement(namespace, localName, prefix,
                                            attributes, context);
  
  
  


Reply via email to