You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Tom Jordahl <to...@macromedia.com> on 2002/09/26 23:58:47 UTC

RE: anyType support fixed

Thanks Rich!
Verified that anyType comes out in the right places for this service:

public class MyService {  
    public String myop(MyStruct in, java.util.Locale locin) {
        return "out";
    }
}
public class MyStruct {
    public java.util.Locale loc;
    public String name;
}


I don't know how to make a test for this, which isn't so important since this service will never work.

Anyone have any thoughts on how we might get a service like this work?
--
Tom Jordahl
Macromedia Server Development



-----Original Message-----
From: scheu@apache.org [mailto:scheu@apache.org]
Sent: Thursday, September 26, 2002 5:52 PM
To: xml-axis-cvs@apache.org
Subject: cvs commit: xml-axis/java/src/org/apache/axis/wsdl/fromJava
Emitter.java Types.java


scheu       2002/09/26 14:52:13

  Modified:    java/src/org/apache/axis/wsdl/fromJava Emitter.java
                        Types.java
  Log:
  More changes per review of code by Tom and I.  this is all related
  to the 12347 bug fix.
  
  Revision  Changes    Path
  1.65      +1 -1      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.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- Emitter.java	26 Sep 2002 21:13:25 -0000	1.64
  +++ Emitter.java	26 Sep 2002 21:52:12 -0000	1.65
  @@ -1088,7 +1088,7 @@
               QName typeQName = 
                   types.writeTypeForPart(javaType,
                                          param.getTypeQName());
  -            types.writeElementForPart(javaType,
  +            QName elemQName = types.writeElementForPart(javaType,
                                         param.getTypeQName());
               if (typeQName != null) {
                   part.setName(param.getName());
  
  
  
  1.63      +13 -7     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.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- Types.java	26 Sep 2002 21:13:25 -0000	1.62
  +++ Types.java	26 Sep 2002 21:52:13 -0000	1.63
  @@ -231,7 +231,9 @@
        * @param type <code>Class</code> to generate the XML Schema info for
        * @param qname <code>QName</code> of the type.  If null, qname is
        *             defaulted from the class.
  -     * @return the QName of the generated Schema type, null if void
  +     * @return the QName of the generated Schema type, null if void,
  +     *         if the Class type cannot be converted to a schema type
  +     *         then xsd:anytype is returned.
        */
       public QName writeTypeForPart(Class type, QName qname) throws AxisFault {
           //patch by costin to fix an NPE; commented out till we find out what the problem is
  @@ -265,8 +267,10 @@
               writeWsdlTypesElement();
           }
   
  -        // write the type
  -        writeType(type, qname);
  +        // Write the type, if problems occur use ANYTYPE
  +        if (writeType(type, qname) == null) {
  +            qname = Constants.XSD_ANYTYPE;
  +        }
           return qname;
       }
   
  @@ -318,8 +322,10 @@
               writeWsdlTypesElement();
           }
   
  -        // Write Element
  -        writeTypeAsElement(type, qname);
  +        // Write Element, if problems occur return null.
  +        if (writeTypeAsElement(type, qname) == null) {
  +            qname = null;
  +        }
           return qname;
       }
   
  @@ -380,7 +386,7 @@
       /**
        * Create a schema element for the given type
        * @param type the class type
  -     * @return the QName of the generated Element or null if no element written
  +     * @return the QName of the generated Element or problems occur
        */
       private QName writeTypeAsElement(Class type, QName qName) throws AxisFault {
           if (qName == null ||
  @@ -598,7 +604,7 @@
        *
        * @param type Class for which to generate schema
        * @param qName of the type to write
  -     * @return a prefixed string for the schema type
  +     * @return a prefixed string for the schema type or null if problems occur
        */
       public String writeType(Class type, QName qName) throws AxisFault {
           // Get a corresponding QName if one is not provided