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 2002/07/25 15:14:19 UTC

cvs commit: xml-axis/java/test/functional TestJAXRPCSamples.java

dims        2002/07/25 06:14:19

  Modified:    java     build.xml
               java/test/functional TestJAXRPCSamples.java
  Added:       java/samples/jaxrpc/address Address.wsdl AddressBean.java
                        AddressClient.java AddressSoapBindingImpl.java
  Log:
  Testcase for Bug 10824 - dynamic proxy client has problem with beans
  
  Notes:
  - Can't recreate the problem in latest cvs. So am closing the bug as well.
  
  Revision  Changes    Path
  1.163     +11 -4     xml-axis/java/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/build.xml,v
  retrieving revision 1.162
  retrieving revision 1.163
  diff -u -r1.162 -r1.163
  --- build.xml	23 Jul 2002 23:47:19 -0000	1.162
  +++ build.xml	25 Jul 2002 13:14:19 -0000	1.163
  @@ -35,11 +35,11 @@
    - javadocs : creates the javadocs in "./build/javadocs"
    - dist     : creates the complete binary distribution
    - srcdist  : creates the complete src distribution
  - - functional-tests : attempts to build Ant task and then run 
  + - functional-tests : attempts to build Ant task and then run
                 client-server functional test
    - war      : create the web application as a WAR file
    - clean    : clean up files and directories
  - 
  +
   
   Custom post-compilation work:
   
  @@ -412,10 +412,18 @@
           <mapping namespace="urn:AddressFetcher2" package="samples.addr"/>
       </wsdl2java>
   
  +    <!-- jaxrpc Dynamic proxy with bean - Bug 10824 -->
  +    <wsdl2java url="samples/jaxrpc/address/Address.wsdl"
  +               output="build/work"
  +               serverSide="yes"
  +               testcase="no">
  +    </wsdl2java>
  +
       <!-- Compile the echo sample generated java files -->
       <javac srcdir="${build.dir}/work" destdir="${build.dest}" debug="${debug}">
         <classpath refid="test-classpath" />
         <include name="samples/addr/**.java" />
  +      <include name="samples/jaxrpc/address/**.java" />
       </javac>
   
   
  @@ -432,7 +440,6 @@
         <exclude name="samples/**/*SMTP*.java" unless="smtp.present" />
         <exclude name="**/old/**/*.java" />
         <exclude name="samples/userguide/example2/Calculator.java"/>
  -<!--      <exclude name="samples/addr/*.java" /> -->
         <exclude name="samples/addr/AddressBookTestCase.java" unless= "junit.present"/>
         <exclude name="samples/userguide/example6/Main.java" />
         <exclude name="samples/userguide/example6/*Impl.java" />
  @@ -580,7 +587,7 @@
     <!-- =================================================================== -->
     <!-- Creates a war file for testing                                      -->
     <!-- =================================================================== -->
  -  <target name="war" depends="compile, samples" 
  +  <target name="war" depends="compile, samples"
         description="Create the web application" >
       <mkdir dir="${build.webapp}"/>
       <copy todir="${build.webapp}">
  
  
  
  1.1                  xml-axis/java/samples/jaxrpc/address/Address.wsdl
  
  Index: Address.wsdl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <wsdl:definitions targetNamespace="http://address.jaxrpc.samples" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://address.jaxrpc.samples" xmlns:intf="http://address.jaxrpc.samples" 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://address.jaxrpc.samples" xmlns="http://www.w3.org/2001/XMLSchema">
     <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
     <complexType name="AddressBean">
      <sequence>
       <element name="street" nillable="true" type="xsd:string"/>
       <element name="postcode" type="xsd:int"/>
      </sequence>
     </complexType>
     <element name="AddressBean" nillable="true" type="impl:AddressBean"/>
    </schema>
    <schema targetNamespace="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema">
     <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
     <element name="int" type="xsd:int"/>
     <element name="string" type="xsd:string"/>
    </schema>
   </wsdl:types>
  
     <wsdl:message name="updateAddressRequest">
  
        <wsdl:part name="in0" type="intf:AddressBean"/>
  
        <wsdl:part name="in1" type="xsd:int"/>
  
     </wsdl:message>
  
     <wsdl:message name="updateAddressResponse">
  
        <wsdl:part name="return" type="xsd:string"/>
  
     </wsdl:message>
  
     <wsdl:portType name="AddressService">
  
        <wsdl:operation name="updateAddress" parameterOrder="in0 in1">
  
           <wsdl:input message="intf:updateAddressRequest" name="updateAddressRequest"/>
  
           <wsdl:output message="intf:updateAddressResponse" name="updateAddressResponse"/>
  
        </wsdl:operation>
  
     </wsdl:portType>
  
     <wsdl:binding name="AddressSoapBinding" type="intf:AddressService">
  
        <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
  
        <wsdl:operation name="updateAddress">
  
           <wsdlsoap:operation soapAction=""/>
  
           <wsdl:input name="updateAddressRequest">
  
              <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://address.jaxrpc.samples" use="encoded"/>
  
           </wsdl:input>
  
           <wsdl:output name="updateAddressResponse">
  
              <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://address.jaxrpc.samples" use="encoded"/>
  
           </wsdl:output>
  
        </wsdl:operation>
  
     </wsdl:binding>
  
     <wsdl:service name="AddressServiceService">
  
        <wsdl:port binding="intf:AddressSoapBinding" name="Address">
  
           <wsdlsoap:address location="http://localhost:8080/axis/services/Address"/>
  
        </wsdl:port>
  
     </wsdl:service>
  
  </wsdl:definitions>
  
  
  
  1.1                  xml-axis/java/samples/jaxrpc/address/AddressBean.java
  
  Index: AddressBean.java
  ===================================================================
  package samples.jaxrpc.address;
  
  public class AddressBean implements java.io.Serializable {
      private java.lang.String street;
      private int postcode;
  
      public AddressBean() {
      }
  
      public java.lang.String getStreet() {
          return street;
      }
  
      public void setStreet(java.lang.String street) {
          this.street = street;
      }
  
      public int getPostcode() {
          return postcode;
      }
  
      public void setPostcode(int postcode) {
          this.postcode = postcode;
      }
  }
  
  
  1.1                  xml-axis/java/samples/jaxrpc/address/AddressClient.java
  
  Index: AddressClient.java
  ===================================================================
  package samples.jaxrpc.address;
  
  import javax.xml.namespace.QName;
  import javax.xml.rpc.Service;
  import javax.xml.rpc.ServiceFactory;
  import java.net.URL;
  
  public class AddressClient {
      public static void main(String[] args) throws Exception {
          URL urlWsdl = new URL("http://localhost:8080/axis/services/Address?wsdl");
          String nameSpaceUri = "http://address.jaxrpc.samples";
          String serviceName = "AddressServiceService";
          String portName = "Address";
  
          ServiceFactory serviceFactory = ServiceFactory.newInstance();
          Service service = serviceFactory.createService(urlWsdl, new
                  QName(nameSpaceUri, serviceName));
          AddressService myProxy = (AddressService) service.getPort(new
                  QName(nameSpaceUri, portName), AddressService.class);
          AddressBean addressBean = new AddressBean();
          addressBean.setStreet("55, rue des Lilas");
          System.out.println(myProxy.updateAddress(addressBean, 75005));
      }
  }
  
  
  1.1                  xml-axis/java/samples/jaxrpc/address/AddressSoapBindingImpl.java
  
  Index: AddressSoapBindingImpl.java
  ===================================================================
  package samples.jaxrpc.address;
  
  public class AddressSoapBindingImpl implements samples.jaxrpc.address.AddressService {
      public String updateAddress(AddressBean addressBean, int newPostCode) throws java.rmi.RemoteException {
          addressBean.setPostcode(newPostCode);
          return ("Your street : " + addressBean.getStreet() + "\nYour postCode : " + newPostCode);
      }
  }
  
  
  
  1.10      +13 -0     xml-axis/java/test/functional/TestJAXRPCSamples.java
  
  Index: TestJAXRPCSamples.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/functional/TestJAXRPCSamples.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestJAXRPCSamples.java	3 Jul 2002 20:21:43 -0000	1.9
  +++ TestJAXRPCSamples.java	25 Jul 2002 13:14:19 -0000	1.10
  @@ -151,9 +151,22 @@
           }
       }
   
  +    public void testAddress() throws Exception {
  +        try {
  +            log.info("Testing JAX-RPC Address sample.");
  +            samples.jaxrpc.address.AddressClient.main(new String[]{});
  +            log.info("Test complete.");
  +        }
  +        catch (Throwable t) {
  +            t.printStackTrace();
  +            throw new Exception("Fault returned from test: " + t);
  +        }
  +    }
  +
       public static void main(String args[]) throws Exception {
           TestJAXRPCSamples tester = new TestJAXRPCSamples("tester");
           tester.testHello();
  +        tester.testAddress();
       } // main
   }