Dear Axis users,

Another piece of the puzzle that I should have mentioned: dynamic proxies
work fine for me (via code much like that below) as long as none of my
return values are type-mapped. So type mapping works and dynamic proxies
work, but they don't work together (for return values) for me. Any
suggestions?

Forwarded message:
> I'm able to call a service which returns a bean via Call, but not via
> dynamic proxies. In the following test code, the block of code which uses
> Call succeeds but the following block, which uses a Stub, fails with a
> ClassCastException.
> 
>       // Create the service
>       Service service = ServiceFactory.newInstance().createService(
>          new URL(wsdlURL), new QName(serviceNamespaceURI, wsdlServiceName));
> 
>       // Register the type mapping
>       TypeMappingRegistry typeMappingRegistry =
>          service.getTypeMappingRegistry();
>       TypeMapping typeMapping = typeMappingRegistry.getTypeMapping(
>          SOAPConstants.URI_NS_SOAP_ENCODING);
>       QName type = new QName("urn:Echo", StringWrapper.class.getName());
>       typeMapping.register(StringWrapper.class, type,
>          new BeanSerializerFactory(StringWrapper.class, type),
>          new BeanDeserializerFactory(StringWrapper.class, type));
> 
>       // Make the call via Call
>       Call call = service.createCall();
>       call.setTargetEndpointAddress(serviceURL);
>       call.setOperationName(
>          new QName(serviceNamespaceURI, "echoStringWrapper"));
>       call.invoke(new Object[] { new StringWrapper("Hi Mom!") });
> 
>       // Make the call via Stub
>       Stub stub = (Stub) service.getPort(Echo.class);
>       ((Echo) stub).echoStringWrapper(new StringWrapper("Hi Mom!"));
> 
> StringWrapper is a test bean with a single String member. Note that in
> both cases I'm ignoring the actual return value; the ClassCastException
> in the latter occurs before the return. Here it is:
> 
> 1) testEchoStringWrapperCall(Test)java.lang.ClassCastException
>     at $Proxy0.echoStringWrapper(Unknown Source)
>     at Test.testEchoStringWrapperCall(Test.java:68)
>     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.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12)
> 
> I inspected the return value in a debugger before it returned from the
> InvocationHandler implementation. It appears to be a correctly initialized
> StringWrapper, with the same ClassLoader as the StringWrapper in my test
> code. Nonetheless, the error occurs. Can anyone suggest a solution?

Thanks,

-- 
| Dave Schweisguth                       http://www.schweisguth.org/~dave/ |
| Home: [EMAIL PROTECTED]          Work: [EMAIL PROTECTED] |
| For compliance with the NJ Right to Know Act: Contents partially unknown |

Reply via email to