java.lang.ClassCastException: org.jboss.axis.message.RPCPara
bsheward Jul 12, 2005 3:17 PMHi,
I think I'm finally getting the hang of things, but I'm having some weird behaviour.
I have been able to return an array of TestValueObject objects from a web services server and the client was able to work with the returned array just fine. The client code (a JUnit test) is:
public void testObjectArray() throws Exception { Service service = getService(); WebServicesTest svc = (WebServicesTest) service.getPort(WebServicesTest.class); TestValueObject[] tvoa = svc.getValueObjectArray(); System.out.println( "WebServicesTest.getValueObjectArray() returned:" + tvoa.toString() ); assertNotNull( tvoa ); assertEquals( WebServicesTestBean.TEST_VALUE_OBJECT_ARRAY.length, tvoa.length ); for( int i = 0; i < tvoa.length; i++ ) { System.out.println( " Testing element " + i + " " + WebServicesTestBean.TEST_VALUE_OBJECT_ARRAY[ i ] + " = " + tvoa[ i ] ); TestValueObject tvo = tvoa[ i ]; assertEquals( WebServicesTestBean.TEST_VALUE_OBJECT_ARRAY[ i ], tvo ); } }
The fact that this works surprised me, because almost identical code which works with a scalar TestValueObject fails with an exception!
The code for working with a scalar TestValueObject is:
public void testObjectResult() throws Exception { Service service = getService(); WebServicesTest svc = (WebServicesTest) service.getPort(WebServicesTest.class); TestValueObject tvo = svc.getValueObject(); System.out.println( "WebServicesTest.getValueObject() returned:" + tvo.toString() ); assertNotNull( tvo ); assertEquals( WebServicesTestBean.TEST_VALUE_OBJECT, tvo ); }
The exception which gets thrown is shown below:
There was 1 error: 1) testObjectResult(com.cybertrust.rmp2.test.wsee.WebServicesTestClient)java.rmi.RemoteException: org.jboss.axis.message.RPCParamElementImpl; nested exception is: java.lang.ClassCastException: org.jboss.axis.message.RPCParamElementImpl at org.jboss.webservice.client.PortProxy.invoke(PortProxy.java:176) at $Proxy1.getValueObject(Unknown Source) at com.cybertrust.rmp2.test.wsee.WebServicesTestClient.testObjectResult(WebServicesTestClient.java:149) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.cybertrust.rmp2.test.wsee.WebServicesTestClient.main(WebServicesTestClient.java:188) Caused by: java.lang.ClassCastException: org.jboss.axis.message.RPCParamElementImpl at $Proxy0.getValueObject(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.jboss.webservice.client.PortProxy.invoke(PortProxy.java:105) ... 20 more FAILURES!!! Tests run: 6, Failures: 0, Errors: 1
If anyone could help me diagnose this problem, I'd really appreciate it!
Thanks and Regards,
Barry