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 di...@apache.org on 2005/02/06 18:12:26 UTC

cvs commit: ws-axis/java/test/wsdl/marshall build.xml marshall.wsdl MarshallBindingImpl.java MarshallTestCase.java

dims        2005/02/06 09:12:26

  Modified:    java/src/org/apache/axis/encoding/ser BeanSerializer.java
  Added:       java/test/wsdl/marshall build.xml marshall.wsdl
                        MarshallBindingImpl.java MarshallTestCase.java
  Log:
  Prevent errors like this one from the test case:
  java.io.IOException: Non nillable element 'myBigDecimal' is null.
  
  Patch from jonas team (" isNillable value depends only on the field type")
  
  Revision  Changes    Path
  1.81      +0 -1      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.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- BeanSerializer.java	11 Jan 2005 23:35:48 -0000	1.80
  +++ BeanSerializer.java	6 Feb 2005 17:12:25 -0000	1.81
  @@ -150,7 +150,6 @@
                               qname = element.getXmlName();
                           }
                           isOmittable = element.isMinOccursZero();
  -                        isNillable = element.isNillable();
                           xmlType = element.getXmlType();
                       }
                   }
  
  
  
  1.1                  ws-axis/java/test/wsdl/marshall/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0" ?>
  <!DOCTYPE project [
          <!ENTITY properties SYSTEM "file:../../../xmls/properties.xml">
          <!ENTITY paths  SYSTEM "file:../../../xmls/path_refs.xml">
          <!ENTITY taskdefs SYSTEM "file:../../../xmls/taskdefs.xml">
          <!ENTITY taskdefs_post_compile SYSTEM "file:../../../xmls/taskdefs_post_compile.xml">
          <!ENTITY targets SYSTEM "file:../../../xmls/targets.xml">
  ]>
  
  <!-- ===================================================================
  <description>
     Test/Sample Component file for Axis
  
  Notes:
     This is a build file for use with the Jakarta Ant build tool.
  
  Prerequisites:
  
     jakarta-ant from http://jakarta.apache.org
  
  Build Instructions:
     To compile
          ant compile
     To execute
          ant run
  
  Author:
    Matt Seibert mseibert@us.ibm.com
  
  Copyright:
    Copyright (c) 2002-2003 Apache Software Foundation.
  </description>
  ==================================================================== -->
  
  <project default="compile">
  
  <property name="axis.home" location="../../.." />
  <property name="componentName" value="test/wsdl/marshall" />
          &properties;
          &paths;
          &taskdefs;
          &taskdefs_post_compile;
          &targets;
  
  <target name="clean">
      <echo message="Removing ${build.dir}/classes/${componentName} and ${build.dir}/work/${componentName}" />
      <delete dir="${build.dir}/classes/${componentName}"/>
      <delete dir="${build.dir}/work/${componentName}"/>
  </target>
  
  <target name="copy" depends="setenv"/>
  
  <target name="compile" depends="copy">
    <echo message="Compiling test.wsdl.marshall"/>
      <!-- marshall Sample Test -->
      <wsdl2java url="${axis.home}/test/wsdl/marshall/marshall.wsdl"
                 output="${axis.home}/build/work"
                 deployscope="session"
                 serverSide="yes"
                 typeMappingVersion="1.3"
                 testcase="yes">
      </wsdl2java>
  
      <copy todir="${build.dir}/work/test/wsdl/marshall" overwrite="yes">
        <fileset dir="${axis.home}/test/wsdl/marshall">
          <include name="*TestCase.java"/>
          <include name="*Impl.java"/>
        </fileset>
      </copy>
  
      <javac srcdir="${build.dir}/work" destdir="${build.dest}" nowarn="${nowarn}" source="${source}" fork="${javac.fork}"
             debug="${debug}">
        <classpath refid="classpath" />
        <include name="test/wsdl/marshall/*.java" />
      </javac>
  
  </target>
  
  <target name="run" >
    <antcall target="execute-Component" />
  </target>
  
  </project>
  
  
  
  1.1                  ws-axis/java/test/wsdl/marshall/marshall.wsdl
  
  Index: marshall.wsdl
  ===================================================================
  <wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" 
                    xmlns:impl="http://marshall.wsdl.test" 
                    xmlns:intf="http://marshall.wsdl.test" 
                    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
                    xmlns:tns1="http://marshall.wsdl.test/types" 
                    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
                    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                    targetNamespace="http://marshall.wsdl.test">
      <wsdl:types>
          <schema targetNamespace="http://marshall.wsdl.test/types" xmlns="http://www.w3.org/2001/XMLSchema">
              <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
              <complexType name="MyBean">
                  <sequence>
                      <element name="myBigDecimal" type="xsd:decimal"/>
                      <element name="myBigDecimalArray" type="xsd:decimal"/>
                      <element name="myBigInteger" type="xsd:integer"/>
                      <element name="myBigIntegerArray" type="xsd:integer"/>
                  </sequence>
              </complexType>
              <complexType name="ArrayOfMyBean">
                  <complexContent>
                      <restriction base="soapenc:Array">
                          <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:MyBean[]"/>
                      </restriction>
                  </complexContent>
              </complexType>
              <complexType name="ArrayOfArrayOfMyBean">
                  <complexContent>
                      <restriction base="soapenc:Array">
                          <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:MyBean[][]"/>
                      </restriction>
                  </complexContent>
              </complexType>
          </schema>
      </wsdl:types>
      <wsdl:message name="MyBeanMultiArrayRequest">
          <wsdl:part name="arrayOfarrayOfMyBean_1" type="tns1:ArrayOfArrayOfMyBean"/>
      </wsdl:message>
      <wsdl:message name="MyBeanMultiArrayResponse">
          <wsdl:part name="result" type="tns1:ArrayOfArrayOfMyBean"/>
      </wsdl:message>
      <wsdl:message name="MyBeanResponse">
          <wsdl:part name="result" type="tns1:MyBean"/>
      </wsdl:message>
      <wsdl:message name="MyBeanArrayResponse">
          <wsdl:part name="result" type="tns1:ArrayOfMyBean"/>
      </wsdl:message>
      <wsdl:message name="MyBeanRequest">
          <wsdl:part name="MyBean_1" type="tns1:MyBean"/>
      </wsdl:message>
      <wsdl:message name="MyBeanArrayRequest">
          <wsdl:part name="arrayOfMyBean_1" type="tns1:ArrayOfMyBean"/>
      </wsdl:message>
      <wsdl:portType name="MarshallPortType">
          <wsdl:operation name="MyBeanArray" parameterOrder="arrayOfMyBean_1">
              <wsdl:input name="MyBeanArrayRequest" message="impl:MyBeanArrayRequest"/>
              <wsdl:output name="MyBeanArrayResponse" message="impl:MyBeanArrayResponse"/>
          </wsdl:operation>
          <wsdl:operation name="MyBeanMultiArray" parameterOrder="arrayOfarrayOfMyBean_1">
              <wsdl:input name="MyBeanMultiArrayRequest" message="impl:MyBeanMultiArrayRequest"/>
              <wsdl:output name="MyBeanMultiArrayResponse" message="impl:MyBeanMultiArrayResponse"/>
          </wsdl:operation>
          <wsdl:operation name="MyBean" parameterOrder="MyBean_1">
              <wsdl:input name="MyBeanRequest" message="impl:MyBeanRequest"/>
              <wsdl:output name="MyBeanResponse" message="impl:MyBeanResponse"/>
          </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="MarshallBinding" type="impl:MarshallPortType">
          <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
          <wsdl:operation name="MyBeanArray">
              <wsdlsoap:operation/>
              <wsdl:input>
                  <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://marshall.wsdl.test"/>
              </wsdl:input>
              <wsdl:output>
                  <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://marshall.wsdl.test"/>
              </wsdl:output>
          </wsdl:operation>
          <wsdl:operation name="MyBeanMultiArray">
              <wsdlsoap:operation/>
              <wsdl:input>
                  <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://marshall.wsdl.test"/>
              </wsdl:input>
              <wsdl:output>
                  <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://marshall.wsdl.test"/>
              </wsdl:output>
          </wsdl:operation>
          <wsdl:operation name="MyBean">
              <wsdlsoap:operation/>
              <wsdl:input>
                  <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://marshall.wsdl.test"/>
              </wsdl:input>
              <wsdl:output>
                  <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://marshall.wsdl.test"/>
              </wsdl:output>
          </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="Marshall">
          <wsdl:port name="MarshallPort" binding="impl:MarshallBinding">
              <wsdlsoap:address location="http://localhost:8080/axis/services/MarshallPort"/>
          </wsdl:port>
      </wsdl:service>
  </wsdl:definitions>
  
  
  
  1.1                  ws-axis/java/test/wsdl/marshall/MarshallBindingImpl.java
  
  Index: MarshallBindingImpl.java
  ===================================================================
  /**
   * MarshallBindingImpl.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis 1.2RC2 Feb 06, 2005 (12:14:42 EST) WSDL2Java emitter.
   */
  
  package test.wsdl.marshall;
  
  public class MarshallBindingImpl implements test.wsdl.marshall.MarshallPortType{
      public test.wsdl.marshall.types.MyBean[] myBeanArray(test.wsdl.marshall.types.MyBean[] arrayOfMyBean_1) throws java.rmi.RemoteException {
          return null;
      }
  
      public test.wsdl.marshall.types.MyBean[][] myBeanMultiArray(test.wsdl.marshall.types.MyBean[][] arrayOfarrayOfMyBean_1) throws java.rmi.RemoteException {
          return null;
      }
  
      public test.wsdl.marshall.types.MyBean myBean(test.wsdl.marshall.types.MyBean myBean_1) throws java.rmi.RemoteException {
          return null;
      }
  
  }
  
  
  
  1.1                  ws-axis/java/test/wsdl/marshall/MarshallTestCase.java
  
  Index: MarshallTestCase.java
  ===================================================================
  /**
   * MarshallTestCase.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis 1.2RC2 Feb 06, 2005 (12:14:42 EST) WSDL2Java emitter.
   */
  
  package test.wsdl.marshall;
  
  public class MarshallTestCase extends junit.framework.TestCase {
      public MarshallTestCase(java.lang.String name) {
          super(name);
      }
  
      public void testMarshallPortWSDL() throws Exception {
          javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
          java.net.URL url = new java.net.URL(new test.wsdl.marshall.MarshallLocator().getMarshallPortAddress() + "?WSDL");
          javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.marshall.MarshallLocator().getServiceName());
          assertTrue(service != null);
      }
  
      public void test1MarshallPortMyBeanArray() throws Exception {
          test.wsdl.marshall.MarshallBindingStub binding;
          try {
              binding = (test.wsdl.marshall.MarshallBindingStub)
                            new test.wsdl.marshall.MarshallLocator().getMarshallPort();
          }
          catch (javax.xml.rpc.ServiceException jre) {
              if(jre.getLinkedCause()!=null)
                  jre.getLinkedCause().printStackTrace();
              throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
          }
          assertNotNull("binding is null", binding);
  
          // Time out after a minute
          binding.setTimeout(60000);
  
          // Test operation
          test.wsdl.marshall.types.MyBean[] value = null;
          value = binding.myBeanArray(new test.wsdl.marshall.types.MyBean[0]);
          // TBD - validate results
      }
  
      public void test2MarshallPortMyBeanMultiArray() throws Exception {
          test.wsdl.marshall.MarshallBindingStub binding;
          try {
              binding = (test.wsdl.marshall.MarshallBindingStub)
                            new test.wsdl.marshall.MarshallLocator().getMarshallPort();
          }
          catch (javax.xml.rpc.ServiceException jre) {
              if(jre.getLinkedCause()!=null)
                  jre.getLinkedCause().printStackTrace();
              throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
          }
          assertNotNull("binding is null", binding);
  
          // Time out after a minute
          binding.setTimeout(60000);
  
          // Test operation
          test.wsdl.marshall.types.MyBean[][] value = null;
          value = binding.myBeanMultiArray(new test.wsdl.marshall.types.MyBean[0][0]);
          // TBD - validate results
      }
  
      public void test3MarshallPortMyBean() throws Exception {
          test.wsdl.marshall.MarshallBindingStub binding;
          try {
              binding = (test.wsdl.marshall.MarshallBindingStub)
                            new test.wsdl.marshall.MarshallLocator().getMarshallPort();
          }
          catch (javax.xml.rpc.ServiceException jre) {
              if(jre.getLinkedCause()!=null)
                  jre.getLinkedCause().printStackTrace();
              throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
          }
          assertNotNull("binding is null", binding);
  
          // Time out after a minute
          binding.setTimeout(60000);
  
          // Test operation
          test.wsdl.marshall.types.MyBean value = null;
          value = binding.myBean(new test.wsdl.marshall.types.MyBean());
          // TBD - validate results
      }
  
  }