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 2003/12/08 02:23:11 UTC

cvs commit: ws-axis/java/test/wsdl/date build.xml MyServiceServiceTestCase.java testdate.wsdl TestdateSoapBindingImpl.java

dims        2003/12/07 17:23:11

  Added:       java/test/wsdl/date build.xml MyServiceServiceTestCase.java
                        testdate.wsdl TestdateSoapBindingImpl.java
  Log:
  testcase for Bug 22999 - xs:date not serialized/deserialized correctly
  
  runtime genned wsdl is wrong.
  
  Revision  Changes    Path
  1.1                  ws-axis/java/test/wsdl/date/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/date" />
          &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.date"/>
      <!-- This tests Bug 9642 -  Java Date not deserialize properly.  -->
      <wsdl2java url="${axis.home}/test/wsdl/date/testdate.wsdl"
                 output="${axis.home}/build/work"
                 serverSide="yes"
                 testcase="yes">
      </wsdl2java>
  
      <copy todir="${build.dir}/work/test/wsdl/date" overwrite="yes">
        <fileset dir="${axis.home}/test/wsdl/date">
          <include name="*TestCase.java"/>
          <include name="*Impl.java"/>
        </fileset>
      </copy>
  
      <javac srcdir="${build.dir}/work" destdir="${build.dest}" debug="${debug}" fork="${javac.fork}">
        <classpath refid="classpath" />
        <include name="test/wsdl/date/*.java" />
      </javac>
  </target>
  
  <target name="run" >
    <antcall target="execute-Component" />
  </target>
  
  </project>
  
  
  
  1.1                  ws-axis/java/test/wsdl/date/MyServiceServiceTestCase.java
  
  Index: MyServiceServiceTestCase.java
  ===================================================================
  /**
   * MyServiceServiceTestCase.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis 1.2alpha Dec 06, 2003 (10:46:24 EST) WSDL2Java emitter.
   */
  
  package test.wsdl.date;
  
  public class MyServiceServiceTestCase extends junit.framework.TestCase {
      public MyServiceServiceTestCase(java.lang.String name) {
          super(name);
      }
      public void test1testdateGetInfo() throws Exception {
          test.wsdl.date.TestdateSoapBindingStub binding;
          try {
              binding = (test.wsdl.date.TestdateSoapBindingStub)
                            new test.wsdl.date.MyServiceServiceLocator().gettestdate();
          }
          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.date.MyBean value = null;
          value = binding.getInfo();
          // TBD - validate results
          System.out.println(value.getDate());
      }
  
  }
  
  
  
  1.1                  ws-axis/java/test/wsdl/date/testdate.wsdl
  
  Index: testdate.wsdl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <wsdl:definitions targetNamespace="http://date.wsdl.test" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://date.wsdl.test" xmlns:intf="http://date.wsdl.test" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <wsdl:types>
          <schema targetNamespace="http://date.wsdl.test" xmlns="http://www.w3.org/2001/XMLSchema">
              <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
              <complexType name="MyBean">
                  <sequence>
                      <element name="date" nillable="true" type="xsd:date"/>
                  </sequence>
              </complexType>
          </schema>
      </wsdl:types>
      <wsdl:message name="getInfoRequest">
      </wsdl:message>
      <wsdl:message name="getInfoResponse">
          <wsdl:part name="getInfoReturn" type="impl:MyBean"/>
      </wsdl:message>
      <wsdl:portType name="MyService">
          <wsdl:operation name="getInfo">
              <wsdl:input message="impl:getInfoRequest" name="getInfoRequest"/>
              <wsdl:output message="impl:getInfoResponse" name="getInfoResponse"/>
          </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="testdateSoapBinding" type="impl:MyService">
          <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
          <wsdl:operation name="getInfo">
              <wsdlsoap:operation soapAction=""/>
              <wsdl:input name="getInfoRequest">
                  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://date.wsdl.test" use="encoded"/>
              </wsdl:input>
              <wsdl:output name="getInfoResponse">
                  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://date.wsdl.test" use="encoded"/>
              </wsdl:output>
          </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="MyServiceService">
          <wsdl:port binding="impl:testdateSoapBinding" name="testdate">
              <wsdlsoap:address location="http://localhost:8080/axis/services/testdate"/>
          </wsdl:port>
      </wsdl:service>
  </wsdl:definitions>
  
  
  
  1.1                  ws-axis/java/test/wsdl/date/TestdateSoapBindingImpl.java
  
  Index: TestdateSoapBindingImpl.java
  ===================================================================
  /**
   * TestdateSoapBindingImpl.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis 1.2alpha Dec 06, 2003 (10:46:24 EST) WSDL2Java emitter.
   */
  
  package test.wsdl.date;
  
  import java.util.*;
  
  public class TestdateSoapBindingImpl implements test.wsdl.date.MyService{
      public test.wsdl.date.MyBean getInfo() throws java.rmi.RemoteException {
          MyBean b = new MyBean();
          Calendar xmas = new GregorianCalendar(1998, Calendar.DECEMBER, 25);
          Date date = xmas.getTime();
          b.setDate(new Date());
          return b;
      }
  
  }