axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <d...@yahoo.com>
Subject RE: passing parameter subclasses using Axis
Date Fri, 06 Sep 2002 12:49:29 GMT
Chad,

Glen is on vacation...Can you please try latest RC1 (and log a bugzilla bug with all the code
needed to reproduce the problem)?

Thanks,
dims

--- Chad <chadnash@optusnet.com.au> wrote:
> Glen thanks for your response.
> Sorry about the lateness of my follow up questions.
> 
> I have downloaded ,altered (to work outside of junit and from a main)
> and used your test scripts.
> in test1PolymorphismTestGetBAsA 
> 	value = binding.getBAsA(false); 
> value came across as an A when it should have been a B ( a B was sent
> back) 
> 
> I am using beta 3
> I am using a separate webapp directory rather than using
> $tomcatHome/webapps/axis
> the axis jars are in $tomcatHome/common/lib (made no difference putting
> them in WEB-INF/lib)
> Java 1.3.1
> windows ME and cygwin (sorry)
> 
> further help would be appreciated.
> 
> Chad
> 
> WSDL2Java command from $tomcatHome/webapps/poly
> java -cp ".;$tccp" org.apache.axis.wsdl.WSDL2Java -S true --all
> -Nhttp://xml.apache.org/axis/PolymorphismTest=test.wsdl.polymorphism
> polymorphism.wsdl
> 
> Deployment command from $tomcatHome/webapps/poly
> java -cp ".;$tccp" org.apache.axis.client.AdminClient
> -lhttp://localhost:8080/poly/servlet/AxisServlet
> test\\wsdl\\polymorphism\\deploy.wsdd
> 
> 
> 
> Source files as I had them follow
> ----------------------------------------
> 
> package test.wsdl.polymorphism;
> 
> import java.net.*;
> 
> public class PolymorphismTest_ServiceTestCase  {
>     public PolymorphismTest_ServiceTestCase() {
> 
>     }
>     public void test1PolymorphismTestGetBAsA() {
>         test.wsdl.polymorphism.PolymorphismTestSoap binding;
>         try {
>             binding = new
> test.wsdl.polymorphism.PolymorphismTest_ServiceLocator().getPolymorphismTest(new
> URL("http://localhost:8080/poly/services/PolymorphismTest"));
>         }
>         catch (Exception e) {
>             throw new RuntimeException("JAX-RPC ServiceException caught:
> " + e);
>         }
> 
>         try {
>             test.wsdl.polymorphism.A value = null;
> 
>             // Passing false here gets us a "B"
>             value = binding.getBAsA(false);
> 
>             // Check out the return value for correctness.
>             if(!(value instanceof B) ){throw new RuntimeException("value
> not B value="+value);}
>             B myB = (B)value;
>            /* assertEquals("B field didn't match",
>                          PolymorphismTestSoapImpl.B_TEXT,
>                          myB.getB());
>             assertEquals("A field didn't match",
>                          PolymorphismTestSoapImpl.A_TEXT,
>                          myB.getA());*/
>         }
>         catch (java.rmi.RemoteException re) {
>             throw new RuntimeException("Remote Exception caught: " +
> re);
>         }
>     }
> 
>     public void test1PolymorphismTestGetCAsA() {
>         test.wsdl.polymorphism.PolymorphismTestSoap binding;
>         try {
>             binding = new
> test.wsdl.polymorphism.PolymorphismTest_ServiceLocator().getPolymorphismTest(new
> URL("http://localhost:8080/poly/services/PolymorphismTest"));
>         }
>         catch (Exception e) {
>             throw new RuntimeException("JAX-RPC ServiceException caught:
> " + e);
>         }
> 
>         try {
>             test.wsdl.polymorphism.A value = null;
> 
>             // Passing true here gets us a "C" on the server side, but
> since
>             // there's no type mapping for that we should just get the
> "A"
>             // part.
>             value = binding.getBAsA(true);
> 
>             // Check out the return value for correctness.
>             if(!( value instanceof A)) {throw new
> RuntimeException("value not A value="+value);}
>             /*assertEquals("A field didn't match",
>                          PolymorphismTestSoapImpl.A_TEXT,
>                          value.getA());*/
>         }
>         catch (java.rmi.RemoteException re) {
>             throw new RuntimeException("Remote Exception caught: " +
> re);
>         }
>     }
> 
>     public static void main(String[] args)
>     {
>         PolymorphismTest_ServiceTestCase p = new
> PolymorphismTest_ServiceTestCase();
>         p.test1PolymorphismTestGetBAsA();
>         p.test1PolymorphismTestGetCAsA();
>     }
> 
> }
> 
> /**
>  * PolymorphismTestSoapImpl.java
>  *
>  * This file was auto-generated from WSDL
>  * by the Apache Axis WSDL2Java emitter.
>  */
> 
> package test.wsdl.polymorphism;
> 
> public class PolymorphismTestSoapImpl implements
> test.wsdl.polymorphism.PolymorphismTestSoap{
>     public static final String B_TEXT = "this is my B field";
>     public static final String A_TEXT = "this is my A field";
> 
>     public test.wsdl.polymorphism.A getBAsA(boolean sendC)
>             throws java.rmi.RemoteException {
>         if (sendC) {
>             C myC = new C();
>             myC.setA(A_TEXT);
>             return myC;
>         } else {
>             B myB = new B();
>             myB.setB(B_TEXT);
>             myB.setA(A_TEXT);
>             System.out.println("returning A B myB="+myB);
>             return myB;
>         }
>     }
> 
> }


=====
Davanum Srinivas - http://xml.apache.org/~dims/

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

Mime
View raw message