tomj        02/02/19 12:55:00

  Modified:    java/src/org/apache/axis/wsdl/toJava SymbolTable.java
               java/src/org/apache/axis/utils resources.properties
  Log:
  Add a 'dotnet' internal switch to the symbol table to prevent treating
  document style WSDL as rpc.  Right now this switch gets turned on
  when we encounter an <attribute> tag in the XML Schema types.
  
  Validate the service name to prevent emitting strange empty filenames.
  
  Comming soon, emit the correct bean function for attributes to direct Axis to
  serialize/deserialize bean properties as attributes.
  
  Revision  Changes    Path
  1.33      +44 -11    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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- SymbolTable.java  15 Feb 2002 19:41:17 -0000      1.32
  +++ SymbolTable.java  19 Feb 2002 20:55:00 -0000      1.33
  @@ -138,6 +138,10 @@
       private boolean debug = false;
   
       private BaseTypeMapping btm = null;
  +
  +    // should we attempt to treat document/literal WSDL as "rpc-style"
  +    private boolean dotNet = true;
  +    
       /**
        * Construct a symbol table with the given Namespaces.
        */
  @@ -279,6 +283,20 @@
       }
   
       /**
  +     * Are we trying to treat document/literal in an "rpc-style" manner.
  +     */ 
  +    public boolean isDotNet() {
  +        return dotNet;
  +    }
  +
  +    /**
  +     * Turn on/off .NET strategy for literal soap body's.
  +     */ 
  +    public void setDotNet(boolean dotNet) {
  +        this.dotNet = dotNet;
  +    }
  +
  +    /**
        * Dump the contents of the symbol table.  For debugging purposes only.
        */
       public void dump(java.io.PrintStream out) {
  @@ -544,6 +562,11 @@
                   // This is a wsdl part.  Create an TypeEntry representing the 
reference
                   createTypeFromRef(node);
               }
  +            else if (nodeKind.getLocalPart().equals("attribute") &&
  +                     Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +                // we can no longer do .NET stuff and treat document as rpc style
  +                this.dotNet = false;
  +            }
           }
   
           if (level == ABOVE_SCHEMA_LEVEL) {
  @@ -1002,7 +1025,7 @@
               QName elementName = part.getElementName();
               QName typeName = part.getTypeName();
               
  -            if (!literal) {
  +            if (!literal || !dotNet) {
                   // not doing literal use, add this type or element name
                   if (typeName != null) {
                       v.add(getType(typeName));
  @@ -1191,6 +1214,14 @@
           Iterator i = def.getServices().values().iterator();
           while (i.hasNext()) {
               Service service = (Service) i.next();
  +
  +            // do a bit of name validation
  +            if (service.getQName() == null ||
  +                service.getQName().getLocalPart() == null || 
  +                service.getQName().getLocalPart().equals("")) {
  +                throw new IOException(JavaUtils.getMessage("BadServiceName00"));
  +            }
  +            
               ServiceEntry sEntry = new ServiceEntry(service);
               symbolTablePut(sEntry);
           }
  @@ -1260,16 +1291,18 @@
       private void setTypeReferences(TypeEntry entry, Document doc,
               boolean literal) {
   
  -        // If this type is ONLY referenced from a literal usage in a binding,
  -        // then isOnlyLiteralReferenced should return true.
  -        if (!entry.isReferenced() && literal) {
  -            entry.setOnlyLiteralReference(true);
  -        }
  -        // If this type was previously only referenced as a literal type,
  -        // but now it is referenced in a non-literal manner, turn off the
  -        // onlyLiteralReference flag.
  -        else if (entry.isOnlyLiteralReferenced() && !literal) {
  -            entry.setOnlyLiteralReference(false);
  +        if (dotNet) {
  +            // If this type is ONLY referenced from a literal usage in a binding,
  +            // then isOnlyLiteralReferenced should return true.
  +            if (!entry.isReferenced() && literal) {
  +                entry.setOnlyLiteralReference(true);
  +            }
  +            // If this type was previously only referenced as a literal type,
  +            // but now it is referenced in a non-literal manner, turn off the
  +            // onlyLiteralReference flag.
  +            else if (entry.isOnlyLiteralReferenced() && !literal) {
  +                entry.setOnlyLiteralReference(false);
  +            }
           }
   
           // If we don't want to emit stuff from imported files, only set the
  
  
  
  1.55      +4 -0      xml-axis/java/src/org/apache/axis/utils/resources.properties
  
  Index: resources.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/resources.properties,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- resources.properties      18 Feb 2002 17:11:48 -0000      1.54
  +++ resources.properties      19 Feb 2002 20:55:00 -0000      1.55
  @@ -642,3 +642,7 @@
   badProp02=Cannot set {0} property when {1} property is not {2}.
   
   literalTypePart00=Error: Message part {0} of operation or fault {1} is specified as 
a type and the soap:body use of binding "{2}" is literal.  This WSDL is not currently 
supported.
  +BadServiceName00=Error: Empty or missing service name
  +AttrNotSimpleType00=Attribute {0} is of type {1}, which is not a simple type
  +
  +
  
  
  


Reply via email to