tomj        2002/09/26 12:21:27

  Modified:    java/src/org/apache/axis/wsdl/fromJava Types.java
               java/src/org/apache/axis/encoding/ser BeanSerializer.java
  Log:
  Fix bug 13007 - Java2WSDL emits type=""
    http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13007
  
  If we get back a null from writeType() in the BeanSerailizer
  type generation code, make the type string xsd:anyType.
  
  NOTE: This will prevent bad WSDL, but it will not allow you to
  publish a service with a method that takes anything other than
  java.lang.Object.
  Example:
    myOp(java.util.Locale inarg)
  will not match an operation defined in wsdd with a parameter:
    <parameter name="inarg" type="tns:anyType"
               xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
  
  Revision  Changes    Path
  1.60      +8 -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.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- Types.java        25 Sep 2002 18:56:16 -0000      1.59
  +++ Types.java        26 Sep 2002 19:21:27 -0000      1.60
  @@ -146,6 +146,13 @@
       }
   
       /**
  +     * Return the namespaces object for the current context
  +     */ 
  +    public Namespaces getNamespaces() {
  +        return namespaces;
  +    }
  +
  +    /**
        * Load the types from the input wsdl file.
        * @param inputWSDL file or URL
        */
  @@ -519,7 +526,7 @@
               if (isBeanCompatible(type, true)) {
                   factory = new BeanSerializerFactory(type, qName);
               } else {
  -                return null; // Don't return an element name
  +                return null;  // Don't return an element name
               }
           }
   
  
  
  
  1.59      +6 -0      
xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java
  
  Index: BeanSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- BeanSerializer.java       20 Sep 2002 20:20:05 -0000      1.58
  +++ BeanSerializer.java       26 Sep 2002 19:21:27 -0000      1.59
  @@ -420,6 +420,12 @@
                               boolean isUnbounded,
                               boolean isOmittable, Element where) throws Exception {
           String elementType = types.writeType(fieldType);
  +        if (elementType == null) {
  +            // If writeType returns null, then emit an anytype in such situations.
  +            QName anyQN = Constants.XSD_ANYTYPE;
  +            String prefix = 
types.getNamespaces().getCreatePrefix(anyQN.getNamespaceURI());
  +            elementType = prefix + ":" + anyQN.getLocalPart();
  +        }
           Element elem = types.createElement(fieldName,
                                              elementType,
                                              types.isNullable(fieldType),
  
  
  


Reply via email to