tomj        02/04/05 13:24:33

  Modified:    java/test/wsdl Wsdl2javaTestSuite.xml
               java/src/org/apache/axis/deployment/wsdd WSDDService.java
                        WSDDOperation.java
               java/src/org/apache/axis/wsdl/toJava Utils.java
                        TypeEntry.java SymbolTable.java
                        JavaWriterFactory.java JavaStubWriter.java
                        JavaDeployWriter.java
               java/src/org/apache/axis/description ServiceDesc.java
               java/src/org/apache/axis/encoding
                        SerializationContextImpl.java
               java/src/org/apache/axis/providers/java RPCProvider.java
               java/src/org/apache/axis/message RPCHandler.java
                        RPCElement.java
               java/src/org/apache/axis/utils NSStack.java
  Log:
  Change to deal with namespace qualification better and fix several bugs.
  
  Add qualify test to WSDL test suite.
   This tests the form="qualified/unqualified" and
   defaultFormElement="qualified/unqualified" schema attributes.
  
  Fix a bug in WSDDService that was always setting the
  encoding style for type mappings to RPC encoded.
  
  In the WSDD operation element:
   - the <elementMapping> tag has been removed.  The code
     to read it is still there, but commented out.
   - A "qname" attribute for the operation was added to provide
     the element name/qname to operation description mapping.
  
  For Anonymous type QNames:
  The ">" is retained on all QNames since they are only used
  internally.  Put a check in Serialization content to prevent
  writing xsi:types that are anonymous types.
  
  Lookup allowed methods by method name instead of XML name.
  
  Add a routine genQNameAttributeString() in toJava.Utils to
  generate an attribute value string that is a valid QName,
  including any necessary prefix mapping.
  
  In the SymbolTable, set the refType of elements with
  anonymous types under them to point to the anonymous
  types. Added a setRefType() setter to TypeElement for
  this.  Modified JavaTypeWriter to handle the change when
  javafying names.
  
  In the ServiceDescription, added a getOperationsByQName() function
  which is used to lookup potentially overloaded operations by QName.
  
  Improved the structure of how RPCElements/RPCHandler deals with
  operation descriptors.  RPCHandler now contains the operation
  instead od RPCElement.  Still some work to be done here, but
  we now lookup operaions by QName and deal with overrides much better.
  
  Fix a serious bug in NSStack having to do with prefix mappings.
  See comment in getPrefixForURI() for details.
  
  JavaDeployWriter now emits the new qname attribute of <operation>.
  This replaces elementMapping subtag.
  
  Fix a bug in Allowed methods that was using the wrong operaion names
  (XML instead of Javafied).
  
  Revision  Changes    Path
  1.93      +9 -0      xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml
  
  Index: Wsdl2javaTestSuite.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- Wsdl2javaTestSuite.xml    2 Apr 2002 00:29:36 -0000       1.92
  +++ Wsdl2javaTestSuite.xml    5 Apr 2002 21:24:32 -0000       1.93
  @@ -731,6 +731,15 @@
           <mapping namespace="http://www.PerfectXML.com/NETWebSvcs/BookService"; 
package="test.wsdl.literal"/>
   
       </wsdl2java>
  +
  +    <!-- This tests element qualification.  -->
  +    <wsdl2java url="test/wsdl/qualify/qualifytest.wsdl"
  +               output="build/work"
  +               serverSide="yes"
  +               testcase="yes">
  +        <mapping namespace="urn:qualifyTest" package="test.wsdl.qualify"/>
  +    </wsdl2java>
  +
       <!-- The following WSDL are BAD.  We're keeping them here so we can -->
       <!-- check periodically to see whether the owner has fixed them.    -->
   
  
  
  
  1.53      +2 -1      
xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
  
  Index: WSDDService.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- WSDDService.java  3 Apr 2002 21:44:41 -0000       1.52
  +++ WSDDService.java  5 Apr 2002 21:24:32 -0000       1.53
  @@ -186,7 +186,8 @@
                   Class cls = cl.loadClass(className);
                   desc.setImplClass(cls);
                   initTMR();
  -                String encStyle = Constants.URI_SOAP_ENC;
  +                String encStyle = (desc.getStyle() == ServiceDesc.STYLE_RPC) ?
  +                    Constants.URI_CURRENT_SOAP_ENC : "";
                   desc.setTypeMapping((TypeMapping)tmr.getTypeMapping(encStyle));
               } catch (Exception ex) {
               }
  
  
  
  1.16      +21 -8     
xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDOperation.java
  
  Index: WSDDOperation.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDOperation.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- WSDDOperation.java        27 Mar 2002 17:53:06 -0000      1.15
  +++ WSDDOperation.java        5 Apr 2002 21:24:32 -0000       1.16
  @@ -74,6 +74,13 @@
   
   /**
    *
  + * Parse the WSDD operation elements.
  + * 
  + * Example: 
  + * <operation name="name" qname="element QName" returnQName="QName">
  + *   <parameter ... />
  + * </operation>
  + * 
    */
   public class WSDDOperation extends WSDDElement
   {
  @@ -92,6 +99,10 @@
   
           desc.setName(e.getAttribute("name"));
   
  +        String qNameStr = e.getAttribute("qname");
  +        if (qNameStr != null && !qNameStr.equals(""))
  +            desc.setElementQName(XMLUtils.getQNameFromString(qNameStr, e));
  +        
           String retQNameStr = e.getAttribute("returnQName");
           if (retQNameStr != null && !retQNameStr.equals(""))
               desc.setReturnQName(XMLUtils.getQNameFromString(retQNameStr, e));
  @@ -103,6 +114,9 @@
               desc.addParameter(parameter.getParameter());
           }
   
  +        // FIXME: No longer needed now that we have the qname attribute on the
  +        // operation itself.
  +        /*
           if (parent.getStyle() == ServiceDesc.STYLE_DOCUMENT) {
               Element [] mappingElements = getChildElements(e, "elementMapping");
               if (mappingElements.length > 1) {
  @@ -119,6 +133,7 @@
                   desc.setElementQName(elQName);
               }
           }
  +        */
       }
   
       /**
  @@ -137,17 +152,15 @@
           if (desc.getName() != null) {
               attrs.addAttribute("", "name", "name", "CDATA", desc.getName());
           }
  -
  -        context.startElement(getElementName(), attrs);
  -
  +        
           if (desc.getElementQName() != null) {
  -            attrs = new AttributesImpl();
  -            attrs.addAttribute("", "qname", "qname", "CDATA",
  +            attrs.addAttribute("", "qname", "qname", 
  +                               "CDATA", 
                                  context.qName2String(desc.getElementQName()));
  -            context.startElement(WSDDConstants.ELEMENTMAP_QNAME, attrs);
  -            context.endElement();
           }
  -        
  +
  +        context.startElement(getElementName(), attrs);
  +
           ArrayList params = desc.getParameters();
           for (Iterator i = params.iterator(); i.hasNext();) {
               ParameterDesc parameterDesc = (ParameterDesc) i.next();
  
  
  
  1.25      +18 -0     xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Utils.java        31 Mar 2002 23:09:34 -0000      1.24
  +++ Utils.java        5 Apr 2002 21:24:32 -0000       1.25
  @@ -807,6 +807,24 @@
       {
           return new QName(qname.getNamespaceURI(), qname.getLocalPart());
       }
  +    
  +    /**
  +     * Generate an XML prefixed attribute value with a corresponding xmlns 
  +     * declaration for the prefix.  If there is no namespace, 
  +     * don't prefix the name or emit the xmlns attribute.
  +     * 
  +     * Caller should provide the enclosing quotes.
  +     * 
  +     * Usage:  println("name=\"" + genXMLQNameString(qname, "foo") + "\""
  +     */ 
  +    public static String genQNameAttributeString(QName qname, String prefix) {
  +        String result;
  +        if (qname.getNamespaceURI() == null || qname.getNamespaceURI().equals(""))
  +            return qname.getLocalPart();
  +        
  +        return prefix + ":" + qname.getLocalPart() + "\" xmlns:" + prefix +
  +                "=\"" + qname.getNamespaceURI();
  +    }
   }
   
   
  
  
  
  1.10      +4 -0      xml-axis/java/src/org/apache/axis/wsdl/toJava/TypeEntry.java
  
  Index: TypeEntry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/TypeEntry.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TypeEntry.java    11 Mar 2002 16:25:32 -0000      1.9
  +++ TypeEntry.java    5 Apr 2002 21:24:32 -0000       1.10
  @@ -293,6 +293,10 @@
           return refType;
       } // getRefType
   
  +    public void setRefType(TypeEntry refType) {
  +        this.refType = refType;
  +    }
  +
       /**
        * Return the dimensions of this type, which can be 0 or more "[]".
        */
  
  
  
  1.52      +13 -0     xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- SymbolTable.java  3 Apr 2002 19:11:37 -0000       1.51
  +++ SymbolTable.java  5 Apr 2002 21:24:32 -0000       1.52
  @@ -709,6 +709,19 @@
                           TypeEntry te = null;
                           if (!isElement) {
                               te = new DefinedType(qName, node);
  +                            
  +                            // check if we are an anonymous type underneath
  +                            // an element.  If so, we point the refType of the
  +                            // element to us (the real type).
  +                            if (qName.getLocalPart().indexOf(ANON_TOKEN) >= 0 ) {
  +                                Node parent = node.getParentNode();
  +                                QName parentQName = Utils.getNodeNameQName(parent);
  +                                TypeEntry parentType = getElement(parentQName);
  +                                if (parentType != null) {
  +                                    parentType.setRefType(te);
  +                                }
  +                            }
  +                            
                           } else {
                               if (!belowSchemaLevel) {
                                   te = new DefinedElement(qName, node);
  
  
  
  1.22      +8 -3      
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriterFactory.java
  
  Index: JavaWriterFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriterFactory.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- JavaWriterFactory.java    29 Mar 2002 22:13:05 -0000      1.21
  +++ JavaWriterFactory.java    5 Apr 2002 21:24:32 -0000       1.22
  @@ -180,9 +180,11 @@
                           dims += tEntry.getDimensions();
                           refType = tEntry.getRefType();
                       }
  +                    
                       // Get the QName to javify
                       QName typeQName = tEntry.getQName();
  -                    if 
(typeQName.getLocalPart().lastIndexOf(SymbolTable.ANON_TOKEN) >= 0) {
  +                    if ((typeQName.getLocalPart().indexOf(SymbolTable.ANON_TOKEN) 
>= 0) &&
  +                            (tEntry.getName() == null)) {
                           // This is an anonymous type name.
                           // Axis uses '>' as a nesting token to generate
                           // unique qnames for anonymous types.
  @@ -196,12 +198,15 @@
                           // If there is already an existing type, there will be a 
                           // collision.  If there is an existing anon type, there 
will be a 
                           // collision.  In both cases, the java type name should be 
mangled.
  -                        if (symbolTable.getType(typeQName) != null ||
  -                            anonQNames.get(typeQName) != null) {
  +                        TypeEntry existing = symbolTable.getType(typeQName);
  +                        if (anonQNames.get(typeQName) != null ||
  +                                (existing != null && 
  +                                !(existing instanceof DefinedElement))) {
                               localName += "Type" + uniqueNum++;
                               typeQName = new QName(typeQName.getNamespaceURI(), 
localName);
                           } 
                           anonQNames.put(typeQName, typeQName);
  +                        tEntry.setName(symbolTable.getJavaName(typeQName) + dims);
                       }
                       entry.setName(symbolTable.getJavaName(typeQName) + dims);
                   }
  
  
  
  1.54      +7 -20     
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.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- JavaStubWriter.java       5 Apr 2002 17:38:40 -0000       1.53
  +++ JavaStubWriter.java       5 Apr 2002 21:24:32 -0000       1.54
  @@ -432,15 +432,7 @@
           }
           firstSer = false ;
   
  -        // If a root Element named Foo has an anon type, the 
  -        // anon type is named ">Foo".  The following hack
  -        // uses the name "Foo" so that the right qname gets 
  -        // registered.
  -        String localPart = type.getQName().getLocalPart();
  -        if (localPart.startsWith(SymbolTable.ANON_TOKEN)) {
  -            localPart = localPart.substring(1);
  -        }
  -        QName qname = new QName(type.getQName().getNamespaceURI(), localPart);
  +        QName qname = type.getQName();
   
           pw.println("            qName = new javax.xml.rpc.namespace.QName(\""
                      + qname.getNamespaceURI() + "\", \"" + qname.getLocalPart()
  @@ -500,18 +492,13 @@
               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.getType().getQName();
  -            String javaType = p.getType().getName();
  -            if (p.getType() instanceof DefinedElement) {
  -                Node node = 
  -                    symbolTable.getTypeEntry(p.getType().getQName(), 
true).getNode();
  -                QName qn2 = Utils.getNodeTypeRefQName(node, "type");
  -                if (qn2 != null) {
  -                    qn = qn2;
  -                    javaType = symbolTable.getType(qn).getName();
  -
  -                }
  +            TypeEntry type = p.getType();
  +            if (type instanceof DefinedElement) {
  +                type = type.getRefType();
               }
  +            QName qn = type.getQName();
  +            String javaType = type.getName();
  +
               if (javaType != null) {
                   javaType += ".class, ";
               } else {
  
  
  
  1.32      +35 -47    
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java
  
  Index: JavaDeployWriter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- JavaDeployWriter.java     4 Apr 2002 19:17:12 -0000       1.31
  +++ JavaDeployWriter.java     5 Apr 2002 21:24:32 -0000       1.32
  @@ -71,6 +71,7 @@
   import javax.wsdl.QName;
   import javax.wsdl.Service;
   import javax.wsdl.Part;
  +import javax.wsdl.Input;
   
   import org.w3c.dom.Node;
   
  @@ -175,21 +176,10 @@
                   process = false;
               }
   
  -            // If a root Element named Foo has an anon type, the 
  -            // anon type is named ">Foo".  The following hack
  -            // uses the name "Foo" so that the right qname gets 
  -            // registered.
  -            String localPart = type.getQName().getLocalPart();
  -            if (localPart.startsWith(SymbolTable.ANON_TOKEN)) {
  -                localPart = localPart.substring(1);
  -            }
  -            QName qName = new QName(type.getQName().getNamespaceURI(), 
  -                                    localPart);
  -
               if (process) {
                   pw.println("      <typeMapping");
  -                pw.println("        xmlns:ns=\"" + qName.getNamespaceURI() + "\"");
  -                pw.println("        qname=\"ns:" + qName.getLocalPart() + '"');
  +                pw.println("        xmlns:ns=\"" + 
type.getQName().getNamespaceURI() + "\"");
  +                pw.println("        qname=\"ns:" + type.getQName().getLocalPart() + 
'"');
                   pw.println("        type=\"java:" + type.getName() + '"');
                   if (type.getName().endsWith("[]")) {
                       pw.println("        
serializer=\"org.apache.axis.encoding.ser.ArraySerializerFactory\"");
  @@ -271,53 +261,54 @@
               BindingOperation bindingOper = (BindingOperation) 
operationsIterator.next();
               Operation operation = bindingOper.getOperation();
               OperationType type = operation.getStyle();
  +            String javaOperName = JavaUtils.xmlNameToJava(operation.getName());
  +            String operationName = operation.getName();
   
               // These operation types are not supported.  The signature
               // will be a string stating that fact.
               if (type != OperationType.NOTIFICATION
                       && type != OperationType.SOLICIT_RESPONSE) {
  -                methodList = methodList + " " + bindingOper.getName();
  +                methodList = methodList + " " + javaOperName;
               }
   
               // We pass "" as the namespace argument because we're just
               // interested in the return type for now.
               Parameters params =
                       symbolTable.getOperationParameters(operation, "", bEntry);
  -            String operName = JavaUtils.xmlNameToJava(operation.getName());
               if (params != null) {
  -                if (params.returnType instanceof DefinedElement) {
  -                    QName returnQName = params.returnType.getQName();
  -                    pw.println("      <operation name=\"" + operName +
  -                             "\" returnQName=\"retNS:" +
  -                             returnQName.getLocalPart() +
  -                             "\" xmlns:retNS=\"" +
  -                             returnQName.getNamespaceURI() +
  -                             "\">");
  -
  -                    // map doc/lit elements to this operation
  -                    Map parts = operation.getInput().getMessage().getParts();
  -                    if (!parts.isEmpty()) {
  +
  +                pw.print("      <operation name=\"" + javaOperName + "\"");
  +
  +                QName elementQName = null;
  +                Input input = operation.getInput();
  +                if (input != null) {
  +                    Map parts = input.getMessage().getParts();
  +                    if (parts != null && !parts.isEmpty()) {
                           Iterator i = parts.values().iterator();
                           Part p = (Part) i.next();
  -                        QName elementQName = p.getElementName();
  -                        String ns = elementQName.getNamespaceURI();
  -                        pw.println("        <elementMapping xmlns:ns=\"" +
  -                                   ns + "\" element=\"ns:" +
  -                                   elementQName.getLocalPart() + "\"/>");
  +                        elementQName = p.getElementName();
                       }
  -                } else {
  -                    pw.print("      <operation name=\"" + 
  -                               operName + "\"");
  -                    if (params.returnName != null) {
  -                        QName returnQName = Utils.getWSDLQName(params.returnName);
  -                        pw.print(" returnQName=\"retNS:" +
  -                             returnQName.getLocalPart() +
  -                             "\" xmlns:retNS=\"" +
  -                             returnQName.getNamespaceURI() + "\"");
  +                    if (elementQName == null) {
  +                        // FIXME - get namespace from WSDL?
  +                        elementQName = new QName("", operationName);
  +                    }
  +                    QName defaultQName = new QName("", javaOperName);
  +                    if (! defaultQName.equals(elementQName)) {
  +                        pw.print(" qname=\"" + 
  +                                 Utils.genQNameAttributeString(elementQName, 
"operNS") +
  +                                 "\"");
                       }
  -                    pw.println(">");
                   }
  -                
  +                QName returnQName = null;
  +                if (params.returnName != null)
  +                    returnQName = Utils.getWSDLQName(params.returnName);
  +                if (returnQName != null) {
  +                    pw.print(" returnQName=\"" + 
  +                             Utils.genQNameAttributeString(returnQName, "retNS") + 
  +                             "\"");
  +                }
  +                pw.println(">");
  +
                   Vector paramList = params.list;
                   for (int i = 0; i < paramList.size(); i++) {
                       Parameter param = (Parameter) paramList.elementAt(i);
  @@ -325,10 +316,7 @@
                       TypeEntry typeEntry = param.getType();
                       QName paramType;
                       if (typeEntry instanceof DefinedElement) {
  -                        Node node = symbolTable.getTypeEntry(typeEntry.getQName(), 
true).getNode();
  -                        paramType = Utils.getNodeTypeRefQName(node, "type");
  -                        if (paramType == null)
  -                            paramType = typeEntry.getQName(); // FIXME
  +                        paramType = typeEntry.getRefType().getQName();
                       } else {
                           paramType = typeEntry.getQName();
                       }
  
  
  
  1.14      +63 -13    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/ServiceDesc.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ServiceDesc.java  3 Apr 2002 06:09:55 -0000       1.13
  +++ ServiceDesc.java  5 Apr 2002 21:24:33 -0000       1.14
  @@ -298,18 +298,14 @@
       }
   
       /**
  -     * Map an XML QName to an operation.
  +     * Map an XML QName to an operation.  Returns the first one it finds
  +     * in the case of mulitple matches.
        */
       public OperationDesc getOperationByElementQName(QName qname)
       {
  -        // If we're a wrapped service (i.e. RPC or WRAPPED style), we expect
  -        // this qname to match one of our operation names directly.
  -
  -        // FIXME : Should this really ignore namespaces?  Perhaps we should
  -        //         just check by QName... (I think that's right, actually,
  -        //         and the only time we should ignore namespaces is when
  -        //         deserializing SOAP-encoded structures?)
  -        if (isWrapped()) {
  +        // If we're an RPC service, we ignore the namespace... should fix
  +        // this later!
  +        if (style == STYLE_RPC) {
               return getOperationByName(qname.getLocalPart());
           }
   
  @@ -322,16 +318,70 @@
           // If we're DOCUMENT style, we look in our mapping of QNames ->
           // operations instead.  But first, let's make sure we've initialized
           // said mapping....
  +        initQNameMap();
  +        
  +        ArrayList overloads = (ArrayList)qname2OperationMap.get(qname);
  +        if (overloads == null)
  +            return null;
  +        
  +        OperationDesc oper = (OperationDesc)overloads.get(0);
  +        getSyncedOperationsForName(implClass, oper.getName());
  +
  +        // Return the first one....
  +        return oper;
  +    }
  +    
  +    /**
  +     * Return all operations which match this QName (i.e. get all the
  +     * overloads)
  +     */ 
  +    public OperationDesc [] getOperationsByQName(QName qname)
  +    {
  +        // If we're an RPC service, we ignore the namespace... should fix
  +        // this later!
  +        if (style == STYLE_RPC) {
  +            return getOperationsByName(qname.getLocalPart());
  +        }
  +
  +        // If we're MESSAGE style, we should only have a single operation,
  +        // to which we'll pass any XML we receive.
  +        if (style == STYLE_MESSAGE) {
  +            return new OperationDesc [] { (OperationDesc)operations.get(0) };
  +        }
  +
  +        // If we're DOCUMENT style, we look in our mapping of QNames ->
  +        // operations instead.  But first, let's make sure we've initialized
  +        // said mapping....
  +        initQNameMap();
  +
  +        ArrayList overloads = (ArrayList)qname2OperationMap.get(qname);
  +
  +        if (overloads == null)
  +            return null;
  +        
  +        getSyncedOperationsForName(implClass,
  +                                   ((OperationDesc)overloads.get(0)).getName());
  +        
  +        OperationDesc [] array = new OperationDesc [overloads.size()];
  +        return (OperationDesc[])overloads.toArray(array);
  +    }
  +
  +    private synchronized void initQNameMap() {
           if (qname2OperationMap == null) {
               qname2OperationMap = new HashMap();
               for (Iterator i = operations.iterator(); i.hasNext();) {
                   OperationDesc operationDesc = (OperationDesc) i.next();
  -                qname2OperationMap.put(operationDesc.getElementQName(),
  -                                       operationDesc);
  +                ArrayList list = 
  +                        (ArrayList)qname2OperationMap.get(operationDesc.
  +                                                          getElementQName());
  +                if (list == null) {
  +                    list = new ArrayList();
  +                    qname2OperationMap.put(operationDesc.getElementQName(),
  +                                           list);
  +                }
  +                list.add(operationDesc);
               }
           }
  -
  -        return (OperationDesc)qname2OperationMap.get(qname);
       }
   
       /**
  
  
  
  1.18      +2 -0      
xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java
  
  Index: SerializationContextImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SerializationContextImpl.java     4 Apr 2002 22:30:24 -0000       1.17
  +++ SerializationContextImpl.java     5 Apr 2002 21:24:33 -0000       1.18
  @@ -59,6 +59,7 @@
   import org.apache.axis.Constants;
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
  +import org.apache.axis.wsdl.toJava.SymbolTable;
   import org.apache.axis.description.ServiceDesc;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.attachments.Attachments;
  @@ -909,6 +910,7 @@
       {
           if (type == null ||
               !shouldSendXSIType() ||
  +             type.getLocalPart().indexOf(SymbolTable.ANON_TOKEN) >= 0 ||
               ((attributes != null) &&
                (attributes.getIndex(Constants.URI_CURRENT_SCHEMA_XSI,
                                   "type") != -1)))
  
  
  
  1.53      +1 -1      
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/RPCProvider.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- RPCProvider.java  31 Mar 2002 04:15:31 -0000      1.52
  +++ RPCProvider.java  5 Apr 2002 21:24:33 -0000       1.53
  @@ -197,7 +197,7 @@
   
               // Check if we can find a Method by this name
               // FIXME : Shouldn't this type of thing have already occurred?
  -            checkMethodName(msgContext, allowedMethods, methodName);
  +            checkMethodName(msgContext, allowedMethods, operation.getName());
   
               // Now create any out holders we need to pass in
               if (numArgs < argValues.length) {
  
  
  
  1.32      +4 -2      xml-axis/java/src/org/apache/axis/message/RPCHandler.java
  
  Index: RPCHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCHandler.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- RPCHandler.java   27 Mar 2002 17:53:07 -0000      1.31
  +++ RPCHandler.java   5 Apr 2002 21:24:33 -0000       1.32
  @@ -106,6 +106,7 @@
       private RPCElement rpcElem;
       private RPCParam currentParam;
       private boolean isResponse;
  +    private OperationDesc operation;
   
       public RPCHandler(RPCElement rpcElem, boolean isResponse)
           throws SAXException
  @@ -114,6 +115,9 @@
           this.isResponse = isResponse;
       }
   
  +    public void setOperation(OperationDesc myOperation) {
  +        this.operation = myOperation;
  +    }
   
       /**
        * Register the start of a parameter (child element of the method call
  @@ -146,8 +150,6 @@
           QName type = null;
           QName qname = new QName(namespace, localName);
           ParameterDesc paramDesc = null;
  -
  -        OperationDesc operation = rpcElem.getOperation();
   
           // Grab xsi:type attribute if present, on either this element or
           // the referent (if it's an href).
  
  
  
  1.48      +21 -17    xml-axis/java/src/org/apache/axis/message/RPCElement.java
  
  Index: RPCElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCElement.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- RPCElement.java   4 Apr 2002 22:30:24 -0000       1.47
  +++ RPCElement.java   5 Apr 2002 21:24:33 -0000       1.48
  @@ -79,7 +79,6 @@
       protected Vector params = new Vector();
       protected boolean needDeser = false;
       protected boolean elementIsFirstParam = false;
  -    protected OperationDesc myOperation = null;
   
       public RPCElement(String namespace,
                         String localName,
  @@ -96,9 +95,6 @@
           needDeser = true;
   
           if (operation != null) {
  -            this.name = operation.getName();
  -            myOperation = operation;
  -
               // IF we're doc/literal... we can't count on the element name
               // being the method name.
               elementIsFirstParam = (operation.getStyle() ==
  @@ -136,11 +132,6 @@
           return name;
       }
   
  -    public OperationDesc getOperation()
  -    {
  -        return myOperation;
  -    }
  -
       protected Class  defaultParamTypes[] = null;
   
       public Class [] getJavaParamTypes()
  @@ -156,12 +147,13 @@
           SOAPService service    = msgContext.getService();
           OperationDesc [] operations = null;
   
  +        // Obtain our possible operations
           if (service != null) {
               ServiceDesc serviceDesc = service.getServiceDescription();
  -
  +            
               if (serviceDesc.getImplClass() == null) {
                   String clsName = (String)service.getOption("className");
  -
  +                
                   if (clsName != null) {
                       ClassLoader cl       = msgContext.getClassLoader();
                       ClassCache cache     = msgContext.getAxisEngine().
  @@ -179,15 +171,23 @@
                       serviceDesc.setImplClass(jc.getJavaClass());
                   }
               }
  -
  +            
               // If we've got a service description now, we want to use
               // the matching operations in there.
  -            operations = serviceDesc.getOperationsByName(name);
  -
  +            QName qname = new QName(namespaceURI, name);
  +            operations = serviceDesc.getOperationsByQName(qname);
  +            
               if (operations == null) {
                   String lc = Utils.xmlNameToJava(name);
                   operations = serviceDesc.getOperationsByName(lc);
               }
  +        } else {
  +            // if we don't have a service (i.e. for client side), the operation
  +            // may already be set in the message context.
  +            OperationDesc oper = msgContext.getOperation();
  +            if (oper != null) {
  +                operations = new OperationDesc [] { oper };
  +            }
           }
   
           // Figure out if we should be looking for out params or in params
  @@ -199,7 +199,7 @@
           // We're going to need this below, so create one.
           RPCHandler rpcHandler = new RPCHandler(this, isResponse);
   
  -        if (operations != null) {
  +        if (operations != null && !msgContext.isClient()) {
               int numParams = (getChildren() == null) ? 0 : getChildren().size();
   
               SAXException savedException = null;
  @@ -213,7 +213,7 @@
                   OperationDesc operation = operations[i];
                   if (operation.getNumInParams() == numParams) {
                       // Set the operation so the RPCHandler can get at it
  -                    myOperation = operation;
  +                    rpcHandler.setOperation(operation);
                       try {
                           if (elementIsFirstParam) {
                               context.pushElementHandler(rpcHandler);
  @@ -227,7 +227,7 @@
                           publishToHandler((org.xml.sax.ContentHandler) context);
   
                           // Success!!  This is the right one...
  -                        msgContext.setOperation(myOperation);
  +                        msgContext.setOperation(operation);
                           return;
                       } catch (SAXException e) {
                           // If there was a problem, try the next one.
  @@ -246,6 +246,10 @@
               }
           }
   
  +        if (operations != null) {
  +            rpcHandler.setOperation(operations[0]);
  +        }
  +        
           if (elementIsFirstParam) {
               context.pushElementHandler(rpcHandler);
               context.setCurElement(null);
  
  
  
  1.22      +20 -2     xml-axis/java/src/org/apache/axis/utils/NSStack.java
  
  Index: NSStack.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/NSStack.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- NSStack.java      3 Apr 2002 21:44:41 -0000       1.21
  +++ NSStack.java      5 Apr 2002 21:24:33 -0000       1.22
  @@ -174,6 +174,21 @@
       }
       */
       
  +    /**
  +     * Return an active prefix for the given namespaceURI.  NOTE : This
  +     * may return null even if the namespaceURI was actually mapped further
  +     * up the stack IF the prefix which was used has been repeated further
  +     * down the stack.  I.e.:
  +     * 
  +     * <pre:outer xmlns:pre="namespace">
  +     *   <pre:inner xmlns:pre="otherNamespace">
  +     *      *here's where we're looking*
  +     *   </pre:inner>
  +     * </pre:outer>
  +     * 
  +     * If we look for a prefix for "namespace" at the indicated spot, we won't
  +     * find one because "pre" is actually mapped to "otherNamespace"
  +     */ 
       public String getPrefix(String namespaceURI) {
           if ((namespaceURI == null) || (namespaceURI.equals("")))
               return null;
  @@ -184,8 +199,11 @@
                   
                   for (int i = 0; i < t.size(); i++) {
                       Mapping map = (Mapping)t.get(i);
  -                    if (map.getNamespaceURI().equals(namespaceURI))
  -                        return map.getPrefix();
  +                    if (map.getNamespaceURI().equals(namespaceURI)) {
  +                        String possiblePrefix = map.getPrefix();
  +                        if (getNamespaceURI(possiblePrefix).equals(namespaceURI))
  +                            return possiblePrefix;
  +                    }
                   }
               }
           }
  
  
  


Reply via email to