axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: ws-axis/java/test/wsdl/wrapped2 employee.wsdl
Date Thu, 18 Nov 2004 17:00:41 GMT
tomj        2004/11/18 09:00:41

  Modified:    java/src/org/apache/axis/description ElementDesc.java
               java/src/org/apache/axis/encoding/ser BeanSerializer.java
               java/src/org/apache/axis/i18n resource.properties
               java/src/org/apache/axis/types Notation.java
               java/src/org/apache/axis/wsdl/fromJava Types.java
               java/src/org/apache/axis/wsdl/toJava
                        JavaBeanHelperWriter.java
               java/test/encoding build.xml DerivatedBean.java
                        ParentBean.java SuperBean.java TestAutoTypes.java
               java/test/wsdl/_import Import.xsd
               java/test/wsdl/include/address Address.xsd
               java/test/wsdl/multiref MultiRefTest.wsdl
               java/test/wsdl/omit omit.wsdl OmitTestCase.java
               java/test/wsdl/types ComprehensiveTypes.wsdl
               java/test/wsdl/wrapped2 employee.wsdl
  Log:
  Patch from Dominik Kacprzak <dominik@sonic.net>, with additional
  changes to the encoding unit tests to pass.
  
  This patch provides a fix for various bugs related to Axis treatment of element's
  nillable attribute. Although the default value of nillable attribute is "false". Axis
  assumes that a nillable attribute is always true and it does not keep track of its
  real value.  It leads to scenarios in which Axis sets a non-nillable, omittable
  element to be null. For Axis there is no difference between the following
  two definitions:
  <element name="areaCode" type="string" minOccurs="0" maxOccurs="1"/>
  and
  <element name="areaCode" type="string" minOccurs="0" maxOccurs="1" nillable="true"/>
  
  The fix adds an additional field to org.apache.axis.description.ElementDesc.  The nillable
property defaults to false and is populated based on web services deployment definition or
element's type.  As a result, Axis enforces stricter rules when generating web services. 
An exception is thrown when a null value is passed as a value of a non-nillable, required
element.
  This patch fixes the following JIRA issues:
   - AXIS-530
   - AXIS-1321
   - AXIS-1332
   - AXIS-1357
   - AXIS-1670
  
  Details:
  - Java/Types.java -
    NOTE: This is most likely the most controversial change.
    1) I changed the method signature to static since it does not access
        any class properties.  This is harmless.
    2) I changed the logic which checks if type can be nullable.
        I couldn't find any justification for why a byte array cannot be null.
       To the contrary, I found an example in JAXRPC patterns that shows a nillable byte array:
http://java.sun.com/developer/technicalArticles/xml/jaxrpcpatterns/index3.html
  
  - I had to fix quite a few schemas and wsdls in functional tests to allow for null elements.
   The test were passing null values for non-nillable elements.
  
  - Extended wsdl.omit test case to cover non-nillable and nillable scenarios.
  
  Revision  Changes    Path
  1.7       +23 -1     ws-axis/java/src/org/apache/axis/description/ElementDesc.java
  
  Index: ElementDesc.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/description/ElementDesc.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ElementDesc.java	8 Jun 2004 16:47:17 -0000	1.6
  +++ ElementDesc.java	18 Nov 2004 17:00:40 -0000	1.7
  @@ -23,13 +23,17 @@
    * XML element
    *
    * @author Glen Daniels (gdaniels@apache.org)
  + * @author Dominik Kacprzak (dominik@opentoolbox.com)
    */
   public class ElementDesc extends FieldDesc implements Serializable {
       /** The minOccurs value from the schema */
       private int minOccurs = 1;
       /** The maxOccurs value from the schema */
       private int maxOccurs = 1;
  -    
  +    /** The nillable value from the schema.
  +     * By default, element cannot be nillable. */
  +    private boolean nillable = false;
  +
       /** If this is an array, this holds the array type */
       private QName arrayType;
       
  @@ -55,6 +59,24 @@
   
       public void setMaxOccurs(int maxOccurs) {
           this.maxOccurs = maxOccurs;
  +    }
  +
  +    /**
  +     * Returns value of nillable property.
  +     *
  +     * @return
  +     */
  +    public boolean isNillable() {
  +        return nillable;
  +    }
  +
  +    /**
  +     * Sets value of nillable property.  Default: <code>false</code>.
  +     *
  +     * @param nillable
  +     */
  +    public void setNillable(boolean nillable) {
  +        this.nillable = nillable;
       }
   
       public QName getArrayType() {
  
  
  
  1.79      +29 -8     ws-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java
  
  Index: BeanSerializer.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- BeanSerializer.java	4 Nov 2004 13:23:34 -0000	1.78
  +++ BeanSerializer.java	18 Nov 2004 17:00:40 -0000	1.79
  @@ -21,6 +21,7 @@
   import org.apache.axis.components.logger.LogFactory;
   import org.apache.axis.description.FieldDesc;
   import org.apache.axis.description.TypeDesc;
  +import org.apache.axis.description.ElementDesc;
   import org.apache.axis.encoding.SerializationContext;
   import org.apache.axis.encoding.Serializer;
   import org.apache.axis.message.MessageElement;
  @@ -122,29 +123,33 @@
                   QName qname = null;
                   QName xmlType = null;
                   boolean isOmittable = false;
  +                // isNillable default value depends on the field type
  +                boolean isNillable = Types.isNullable(propertyDescriptor[i].getType());
   
                   // If we have type metadata, check to see what we're doing
                   // with this field.  If it's an attribute, skip it.  If it's
                   // an element, use whatever qname is in there.  If we can't
                   // find any of this info, use the default.
  -
                   if (typeDesc != null) {
                       FieldDesc field = typeDesc.getFieldByName(propName);
                       if (field != null) {
  -                        if (!field.isElement())
  +                        if (!field.isElement()) {
                               continue;
  +                        }
  +
  +                        ElementDesc element = (ElementDesc)field;
   
                           // If we're SOAP encoded, just use the local part,
                           // not the namespace.  Otherwise use the whole
                           // QName.
                           if (isEncoded) {
  -                            qname = new QName(
  -                                          field.getXmlName().getLocalPart());
  +                            qname = new QName(element.getXmlName().getLocalPart());
                           } else {
  -                            qname = field.getXmlName();
  +                            qname = element.getXmlName();
                           }
  -                        isOmittable = field.isMinOccursZero();
  -                        xmlType = field.getXmlType();
  +                        isOmittable = element.isMinOccursZero();
  +                        isNillable = element.isNillable();
  +                        xmlType = element.getXmlType();
                       }
                   }
   
  @@ -164,6 +169,13 @@
                           // Normal case: serialize the value
                           Object propValue =
                               propertyDescriptor[i].get(value);
  +
  +                        // an element cannot be null if nillable property is set to "false"
  +                        // and the element cannot be omitted
  +                        if (propValue == null && !isNillable && !isOmittable)
{
  +                            throw new IOException(Messages.getMessage("nullNonNillableElement",
propName));
  +                        }
  +
                           // if meta data says minOccurs=0, then we can skip
                           // it if its value is null and we aren't doing SOAP
                           // encoding.
  @@ -424,9 +436,18 @@
                   elementType = prefix + ":" + anyQN.getLocalPart();
               }
   
  +            // isNillable default value depends on the field type
  +            boolean isNillable = Types.isNullable(fieldType);
  +            if (typeDesc != null) {
  +                FieldDesc field = typeDesc.getFieldByName(fieldName);
  +                if (field != null && field.isElement()) {
  +                    isNillable = ((ElementDesc)field).isNillable();
  +                }
  +            }
  +
               elem = types.createElement(fieldName,
                       elementType,
  -                    types.isNullable(fieldType),
  +                    isNillable,
                       isOmittable,
                       where.getOwnerDocument());
           }
  
  
  
  1.99      +1 -0      ws-axis/java/src/org/apache/axis/i18n/resource.properties
  
  Index: resource.properties
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/i18n/resource.properties,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- resource.properties	14 Nov 2004 05:03:53 -0000	1.98
  +++ resource.properties	18 Nov 2004 17:00:40 -0000	1.99
  @@ -488,6 +488,7 @@
   
   nullHandler00={0}:  Null handler;
   nullNamespaceURI=Null namespace URI specified.
  +nullNonNillableElement=Non nillable element ''{0}'' is null.
   nullParent00=null parent!
   
   nullProvider00=Null provider type passed to WSDDProvider!
  
  
  
  1.6       +7 -3      ws-axis/java/src/org/apache/axis/types/Notation.java
  
  Index: Notation.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/types/Notation.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Notation.java	25 Feb 2004 14:02:47 -0000	1.5
  +++ Notation.java	18 Nov 2004 17:00:40 -0000	1.6
  @@ -137,9 +137,13 @@
           typeDesc.addFieldDesc(field);
   
           // An element with a specified QName
  -        field = new ElementDesc();
  -        field.setFieldName("system");
  -        field.setXmlName(Constants.XSD_ANYURI);
  +        ElementDesc element = null;
  +        element = new ElementDesc();
  +        element.setFieldName("system");
  +        element.setXmlName(Constants.XSD_ANYURI);
  +        // per, http://www.w3.org/TR/xmlschema-1/#element-notation,
  +        // "system" property can be null  
  +        element.setNillable(true);
           typeDesc.addFieldDesc(field);
       }
   
  
  
  
  1.102     +3 -7      ws-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java
  
  Index: Types.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- Types.java	11 Nov 2004 23:13:39 -0000	1.101
  +++ Types.java	18 Nov 2004 17:00:40 -0000	1.102
  @@ -1452,17 +1452,13 @@
       }
   
       /**
  -     * Determines if the field is nullable. All non-primitives except
  -     * for byte[] are nillable.
  +     * Determines if the field is nullable. All non-primitives are nillable.
        *
        * @param type input Class
        * @return true if nullable
        */
  -    public boolean isNullable(Class type) {
  -
  -        if (type.isPrimitive()
  -                || (type.isArray()
  -                && (type.getComponentType() == byte.class))) {
  +    public static boolean isNullable(Class type) {
  +        if (type.isPrimitive()) {
               return false;
           } else {
               return true;
  
  
  
  1.48      +3 -0      ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java
  
  Index: JavaBeanHelperWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- JavaBeanHelperWriter.java	14 Sep 2004 13:07:26 -0000	1.47
  +++ JavaBeanHelperWriter.java	18 Nov 2004 17:00:41 -0000	1.48
  @@ -368,6 +368,9 @@
                       if (elem.getMinOccursIs0()) {
                           pw.println("        elemField.setMinOccurs(0);");
                       }
  +                    if (elem.getNillable()) {
  +                        pw.println("        elemField.setNillable(true);");
  +                    }
   
                       pw.println("        typeDesc.addFieldDesc(elemField);");
                   }
  
  
  
  1.11      +1 -1      ws-axis/java/test/encoding/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/encoding/build.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- build.xml	2 Jun 2004 17:05:16 -0000	1.10
  +++ build.xml	18 Nov 2004 17:00:41 -0000	1.11
  @@ -63,7 +63,7 @@
   </target>
   
   <target name="run" >
  -  <antcall target="execute-Component" />
  +  <antcall target="execute-Component-noServer" />
   </target>
   
   </project>
  
  
  
  1.4       +5 -1      ws-axis/java/test/encoding/DerivatedBean.java
  
  Index: DerivatedBean.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/encoding/DerivatedBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DerivatedBean.java	25 Feb 2004 14:02:54 -0000	1.3
  +++ DerivatedBean.java	18 Nov 2004 17:00:41 -0000	1.4
  @@ -16,6 +16,8 @@
   
   package test.encoding;
   
  +import org.apache.axis.description.ElementDesc;
  +
   /**
    * A type used for testing serialization of inherited elements
    */
  @@ -62,15 +64,17 @@
   		new org.apache.axis.description.TypeDesc(DerivatedBean.class);
   
   	static {
  -		org.apache.axis.description.FieldDesc field = new org.apache.axis.description.ElementDesc();
  +		org.apache.axis.description.ElementDesc field = new org.apache.axis.description.ElementDesc();
   		field.setFieldName("three");
   		field.setXmlName(new javax.xml.namespace.QName("", "three"));
   		field.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
  +        field.setNillable(true);
   		typeDesc.addFieldDesc(field);
   		field = new org.apache.axis.description.ElementDesc();
   		field.setFieldName("four");
   		field.setXmlName(new javax.xml.namespace.QName("", "four"));
   		field.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
  +        field.setNillable(true);
   		typeDesc.addFieldDesc(field);
   	};
   
  
  
  
  1.6       +1 -0      ws-axis/java/test/encoding/ParentBean.java
  
  Index: ParentBean.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/encoding/ParentBean.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ParentBean.java	25 Feb 2004 14:02:54 -0000	1.5
  +++ ParentBean.java	18 Nov 2004 17:00:41 -0000	1.6
  @@ -62,6 +62,7 @@
           field = new ElementDesc();
           field.setFieldName("parentStr");
           field.setXmlName(new QName("", "parentElement"));
  +        ((ElementDesc)field).setNillable(true);
           typeDesc.addFieldDesc(field);
       }
       
  
  
  
  1.4       +6 -1      ws-axis/java/test/encoding/SuperBean.java
  
  Index: SuperBean.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/encoding/SuperBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SuperBean.java	25 Feb 2004 14:02:54 -0000	1.3
  +++ SuperBean.java	18 Nov 2004 17:00:41 -0000	1.4
  @@ -16,6 +16,8 @@
   
   package test.encoding;
   
  +import org.apache.axis.description.ElementDesc;
  +
   /**
    * A simple type with several elements for testing serialization
    */
  @@ -79,20 +81,23 @@
   		new org.apache.axis.description.TypeDesc(SuperBean.class);
   
   	static {
  -		org.apache.axis.description.FieldDesc field = new org.apache.axis.description.ElementDesc();
  +		org.apache.axis.description.ElementDesc field = new org.apache.axis.description.ElementDesc();
   		field.setFieldName("zero");
   		field.setXmlName(new javax.xml.namespace.QName("", "zero"));
   		field.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
  +        field.setNillable(true);
   		typeDesc.addFieldDesc(field);
   		field = new org.apache.axis.description.ElementDesc();
   		field.setFieldName("one");
   		field.setXmlName(new javax.xml.namespace.QName("", "one"));
   		field.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
  +        field.setNillable(true);
   		typeDesc.addFieldDesc(field);
   		field = new org.apache.axis.description.ElementDesc();
   		field.setFieldName("two");
   		field.setXmlName(new javax.xml.namespace.QName("", "two"));
   		field.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
  +        field.setNillable(true);
   		typeDesc.addFieldDesc(field);
   	};
   
  
  
  
  1.4       +2 -2      ws-axis/java/test/encoding/TestAutoTypes.java
  
  Index: TestAutoTypes.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/encoding/TestAutoTypes.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestAutoTypes.java	25 Nov 2003 06:07:02 -0000	1.3
  +++ TestAutoTypes.java	18 Nov 2004 17:00:41 -0000	1.4
  @@ -28,7 +28,7 @@
           tm.setDoAutoTypes(true);
           
           QName qname = tm.getTypeQName( AttributeBean.class );
  -        assertEquals( "http://encoding.test", 
  +        assertEquals( "http://encoding.test/",
                         qname.getNamespaceURI() );
           assertEquals( "AttributeBean", qname.getLocalPart() );
           
  @@ -36,7 +36,7 @@
           assertTrue( tm.getSerializer(AttributeBean.class) != null );
   
           assertEquals(
  -            "http://encoding.test",
  +            "http://encoding.test/",
               Namespaces.makeNamespace(AttributeBean[].class.getName()));
           assertEquals(
               "AttributeBean[]",
  
  
  
  1.3       +4 -4      ws-axis/java/test/wsdl/_import/Import.xsd
  
  Index: Import.xsd
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/_import/Import.xsd,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Import.xsd	31 May 2002 19:08:12 -0000	1.2
  +++ Import.xsd	18 Nov 2004 17:00:41 -0000	1.3
  @@ -12,11 +12,11 @@
       <complexType name="Address">
         <all>
           <element name="streetNum" type="int"/>
  -        <element name="streetName" type="string"/>
  -        <element name="city" type="string"/>
  -        <element name="state" type="string"/>
  +        <element name="streetName" nillable="true" type="string"/>
  +        <element name="city" nillable="true" type="string"/>
  +        <element name="state" nillable="true" type="string"/>
           <element name="zip" type="int"/>
  -        <element name="phoneNumber" type="tns:PhoneNumber"/>
  +        <element name="phoneNumber" nillable="true" type="tns:PhoneNumber"/>
         </all>
       </complexType>
   
  
  
  
  1.2       +2 -2      ws-axis/java/test/wsdl/include/address/Address.xsd
  
  Index: Address.xsd
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/include/address/Address.xsd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Address.xsd	12 Jul 2002 19:40:57 -0000	1.1
  +++ Address.xsd	18 Nov 2004 17:00:41 -0000	1.2
  @@ -7,8 +7,8 @@
   
     <xsd:complexType name="address">
       <xsd:all>
  -      <xsd:element name="streetNum" type="xsd:int"/>
  -      <xsd:element name="streetName" type="xsd:string"/>
  +      <xsd:element name="streetNum" nillable="true" type="xsd:int"/>
  +      <xsd:element name="streetName" nillable="true" type="xsd:string"/>
         <xsd:element name="city" type="xsd:string"/>
         <xsd:element name="state" type="typens:stateType"/>
         <xsd:element name="zip" type="xsd:int"/>
  
  
  
  1.2       +2 -2      ws-axis/java/test/wsdl/multiref/MultiRefTest.wsdl
  
  Index: MultiRefTest.wsdl
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/multiref/MultiRefTest.wsdl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MultiRefTest.wsdl	4 Jan 2002 19:09:41 -0000	1.1
  +++ MultiRefTest.wsdl	18 Nov 2004 17:00:41 -0000	1.2
  @@ -16,8 +16,8 @@
                 
         <xsd:complexType name="nodebase">
           <xsd:all>
  -            <xsd:element name="left" type="typens:node" xsd:nillable="true"/>
  -            <xsd:element name="right" type="typens:node" xsd:nillable="true"/>
  +            <xsd:element name="left" type="typens:node" nillable="true"/>
  +            <xsd:element name="right" type="typens:node" nillable="true"/>
           </xsd:all>
         </xsd:complexType>
   
  
  
  
  1.2       +6 -3      ws-axis/java/test/wsdl/omit/omit.wsdl
  
  Index: omit.wsdl
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/omit/omit.wsdl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- omit.wsdl	30 May 2002 18:55:21 -0000	1.1
  +++ omit.wsdl	18 Nov 2004 17:00:41 -0000	1.2
  @@ -8,9 +8,12 @@
           <s:element name="Phone">
               <s:complexType>
                   <s:sequence>
  -                    <s:element name="areaCode" type="s:string" maxOccurs="1" minOccurs="0"/>
  -                    <s:element name="prefix" type="s:string" maxOccurs="1" minOccurs="0"/>
  -                    <s:element name="number" type="s:string" maxOccurs="1" minOccurs="0"/>
  +                    <!-- required element; not nillable -->
  +                    <s:element name="areaCode" type="s:string" minOccurs="1" maxOccurs="1"/>
  +                    <!-- optional element; not nillable -->
  +                    <s:element name="prefix" type="s:string" minOccurs="0" maxOccurs="1"/>
  +                    <!-- optional element; nillable -->
  +                    <s:element name="number" type="s:string" nillable="true" minOccurs="0"
maxOccurs="1"/>
                   </s:sequence>
               </s:complexType>
           </s:element>
  
  
  
  1.7       +37 -8     ws-axis/java/test/wsdl/omit/OmitTestCase.java
  
  Index: OmitTestCase.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/omit/OmitTestCase.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- OmitTestCase.java	15 Oct 2004 16:42:17 -0000	1.6
  +++ OmitTestCase.java	18 Nov 2004 17:00:41 -0000	1.7
  @@ -34,9 +34,17 @@
   package test.wsdl.omit;
   
   public class OmitTestCase extends junit.framework.TestCase {
  +    private static final String AREA_CODE = "111";
       public OmitTestCase(String name) {
           super(name);
       }
  +    /**
  +     * Optimistic scenario:
  +     *   - area code is echoed successfully
  +     *   - prefix is not part of XML exchanged between the client and servers
  +     *   - number is passed as null.
  +     * There does not seem to be a good way to verify what's exchanged over the wire.
  +     */
       public void test1OmitEchoPhone() {
           test.wsdl.omit.Omit binding;
           try {
  @@ -49,20 +57,41 @@
   
           try {
               test.wsdl.omit.Phone input = new test.wsdl.omit.Phone();
  -            input.setPrefix("555");
  -            input.setNumber("1212");
  +            input.setAreaCode(AREA_CODE);
   
               test.wsdl.omit.Phone out = binding.echoPhone(input);
  -            
  -            // TODO: Verify the XML omitted the element
  +
               assertNotNull("The return value from the operation was null", out);
  -            assertNull("areacode is not null", out.getAreaCode());
  -            assertEquals("prefix is incorrect", "555", out.getPrefix());
  -            assertEquals("number is incorrect", "1212", out.getNumber());
  -            
  +            assertEquals("area code is incorrect", AREA_CODE, out.getAreaCode());
  +            assertNull("prefix is not null", out.getPrefix());
  +            assertNull("number is not null", out.getNumber());
           }
           catch (java.rmi.RemoteException re) {
               throw new junit.framework.AssertionFailedError("Remote Exception caught: "
+ re);
  +        }
  +    }
  +
  +    /**
  +     * Validating that an exception is thrown when area code (which is a required element)
is null:
  +     */
  +    public void test2OmitEchoPhone() {
  +        test.wsdl.omit.Omit binding;
  +        try {
  +            binding = new test.wsdl.omit.OmitTestLocator().getomit();
  +        }
  +        catch (javax.xml.rpc.ServiceException jre) {
  +            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught:
" + jre);
  +        }
  +        assertTrue("binding is null", binding != null);
  +
  +        try {
  +            test.wsdl.omit.Phone input = new test.wsdl.omit.Phone();
  +            test.wsdl.omit.Phone out = binding.echoPhone(input);
  +            throw new junit.framework.AssertionFailedError("web services call succeeded
despite of AreaCode being null.");
  +        }
  +        catch (java.rmi.RemoteException re) {
  +            // this is desired
  +            System.out.println(re);
           }
       }
   
  
  
  
  1.50      +6 -6      ws-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl
  
  Index: ComprehensiveTypes.wsdl
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- ComprehensiveTypes.wsdl	15 Dec 2003 19:25:20 -0000	1.49
  +++ ComprehensiveTypes.wsdl	18 Nov 2004 17:00:41 -0000	1.50
  @@ -58,16 +58,16 @@
         <xsd:complexType name="complexAll">
           <xsd:all>
             <xsd:element name="areaCode" type="xsd:int"/>
  -          <xsd:element name="exchange" type="xsd:string"/>
  -          <xsd:element name="number" type="xsd:string"/>
  +          <xsd:element name="exchange" nillable="true" type="xsd:string"/>
  +          <xsd:element name="number" nillable="true" type="xsd:string"/>
           </xsd:all>
         </xsd:complexType>
   
         <xsd:complexType name="complexSequence">
           <xsd:sequence>
             <xsd:element name="areaCode" type="xsd:int"/>
  -          <xsd:element name="exchange" type="xsd:string"/>
  -          <xsd:element name="number" type="xsd:string"/>
  +          <xsd:element name="exchange" nillable="true" type="xsd:string"/>
  +          <xsd:element name="number" nillable="true" type="xsd:string"/>
           </xsd:sequence>
         </xsd:complexType>
   
  @@ -108,7 +108,7 @@
   
         <xsd:complexType name="complexWComplex">
           <xsd:sequence>
  -          <xsd:element name="stock_quote">
  +          <xsd:element name="stock_quote" nillable="true">
               <xsd:complexType>
                 <xsd:attribute name="symbol" type="xsd:string"/> 
                 <xsd:sequence>
  @@ -118,7 +118,7 @@
                   <xsd:element name="pctchange" type="xsd:string"/>
                   <xsd:element name="bid" type="xsd:string"/>
                   <xsd:element name="ask" type="xsd:string"/>
  -                <xsd:element name="choice" type="typens:complexChoice"/>
  +                <xsd:element name="choice" nillable="true" type="typens:complexChoice"/>
                 </xsd:sequence>
                 <xsd:attribute name="last" type="xsd:string"/>
               </xsd:complexType>
  
  
  
  1.3       +2 -2      ws-axis/java/test/wsdl/wrapped2/employee.wsdl
  
  Index: employee.wsdl
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/wrapped2/employee.wsdl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- employee.wsdl	4 Nov 2003 13:26:21 -0000	1.2
  +++ employee.wsdl	18 Nov 2004 17:00:41 -0000	1.3
  @@ -13,8 +13,8 @@
   			</xsd:complexType>
   			<xsd:complexType name="NameType">
   				<xsd:sequence>
  -					<xsd:element name="firstName" type="xsd:string"/>
  -					<xsd:element name="lastName" type="xsd:string"/>
  +					<xsd:element name="firstName" nillable="true" type="xsd:string"/>
  +					<xsd:element name="lastName" nillable="true" type="xsd:string"/>
   				</xsd:sequence>
   			</xsd:complexType>
   			<xsd:complexType name="NameArrayType">
  
  
  

Mime
View raw message