axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/wsdl/fromJava Emitter.java Namespaces.java Types.java
Date Fri, 20 Dec 2002 16:51:24 GMT
dims        2002/12/20 08:51:24

  Modified:    java/src/org/apache/axis/wsdl/fromJava Emitter.java
                        Namespaces.java Types.java
  Log:
  Fix for Bug 15058 - WSDL Emitter does not output xml namespace declarations for mappings
used only in extraclasses.
  
  Revision  Changes    Path
  1.81      +10 -7     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/Emitter.java,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- Emitter.java	17 Dec 2002 20:45:19 -0000	1.80
  +++ Emitter.java	20 Dec 2002 16:51:24 -0000	1.81
  @@ -206,12 +206,13 @@
               filename2 = getServicePortName() + "_implementation.wsdl";
           }
   
  -        // Write out the interface def
  -        Document doc = WSDLFactory.newInstance().
  -            newWSDLWriter().getDocument(intf);
           for (int i = 0; extraClasses != null && i < extraClasses.length; i++)
{
               types.writeTypeForPart(extraClasses[i], null);
           }
  +        //types.updateNamespaces();
  +        // Write out the interface def
  +        Document doc = WSDLFactory.newInstance().
  +            newWSDLWriter().getDocument(intf);
           types.insertTypesFragment(doc);
           prettyDocumentToFile(doc, filename1);
   
  @@ -259,20 +260,22 @@
           switch (mode) {
               case MODE_ALL:
                   def = getWSDL();
  -                doc = WSDLFactory.newInstance().
  -                    newWSDLWriter().getDocument(def);
                   for (int i = 0; extraClasses != null && i < extraClasses.length;
i++) {
                       types.writeTypeForPart(extraClasses[i], null);
                   }
  +                //types.updateNamespaces();
  +                doc = WSDLFactory.newInstance().
  +                    newWSDLWriter().getDocument(def);
                   types.insertTypesFragment(doc);
                   break;
               case MODE_INTERFACE:
                   def = getIntfWSDL();
  -                doc = WSDLFactory.newInstance().
  -                    newWSDLWriter().getDocument(def);
                   for (int i = 0; extraClasses != null && i < extraClasses.length;
i++) {
                       types.writeTypeForPart(extraClasses[i], null);
                   }
  +                //types.updateNamespaces();
  +                doc = WSDLFactory.newInstance().
  +                    newWSDLWriter().getDocument(def);
                   types.insertTypesFragment(doc);
                   break;
               case MODE_IMPLEMENTATION:
  
  
  
  1.7       +8 -0      xml-axis/java/src/org/apache/axis/wsdl/fromJava/Namespaces.java
  
  Index: Namespaces.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Namespaces.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Namespaces.java	4 Nov 2002 17:01:28 -0000	1.6
  +++ Namespaces.java	20 Dec 2002 16:51:24 -0000	1.7
  @@ -219,4 +219,12 @@
           }
           return protocol + "://" + sb.toString();
       }
  +    
  +    /**
  +     * Get the list of namespaces currently registered
  +     * @return iterator
  +     */ 
  +    public Iterator getNamespaces() {
  +        return namespacePrefixMap.keySet().iterator();            
  +    }
   }
  
  
  
  1.68      +14 -1     xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java
  
  Index: Types.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- Types.java	11 Dec 2002 22:38:28 -0000	1.67
  +++ Types.java	20 Dec 2002 16:51:24 -0000	1.68
  @@ -95,6 +95,7 @@
   import java.util.HashMap;
   import java.util.List;
   import java.util.Vector;
  +import java.util.Iterator;
   
   /**
    *
  @@ -1054,12 +1055,24 @@
           }
       }
   
  +    public void updateNamespaces() {
  +        Namespaces namespaces = getNamespaces();
  +        Iterator nspIterator = namespaces.getNamespaces();
  +        while(nspIterator.hasNext()) {
  +            String nsp = (String) nspIterator.next();
  +            String pref = def.getPrefix(nsp);
  +            if (pref == null) {
  +                def.addNamespace(namespaces.getCreatePrefix(nsp), nsp);
  +            }                
  +        }
  +    }
  +    
       /**
        * Inserts the type fragment into the given wsdl document
        * @param doc
        */
       public void insertTypesFragment(Document doc) {
  -
  +        updateNamespaces();
           if (wsdlTypesElem != null) {
               // Import the wsdlTypesElement into the doc.
               org.w3c.dom.Node node = doc.importNode(wsdlTypesElem, true);
  
  
  

Mime
View raw message