You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jose MarĂ­a Zaragoza <de...@gmail.com> on 2013/02/25 16:25:52 UTC

CXF cannot cast jaxws_asm.TypeResponse to String in AsyncHandler.handleResponse method

Hello:

I'm curious about one thing on asynchronous call,  by using a JAX-WS
proxy-client

If I define WRAPPED as SOAP binding ( ie. default ) in SEI ,  and I
define a  AsyncHandler class as a subclass of AsyncHandler<String>
, I get the next exception when performing a asyncronous call to
'send' method, by using a JAX-WS proxy-client


java.lang.ClassCastException:
com.example.email.client.jaxws_asm.SendResponse cannot be cast to
java.lang.String
	at com.example.email.client.EmailAsyncHandler.handleResponse(EmailAsyncHandler.java:20)
	at org.apache.cxf.jaxws.JaxwsClientCallback.handleResponse(JaxwsClientCallback.java:44)




This is my AsyncHandler class

public class EmailAsyncHandler implements AsyncHandler<String>
{

    public void handleResponse(Response<String> response)
    {
        try
        {	
        	System.out.println("Asynchronous response:" + response.get());

        }
        catch (Exception ex)
        {
            ex.printStackTrace();
        }
    }


}


If I use an own SendResponse type as response wrapper type, it works
fine when I perform an asynchronous call
If I use String as request type, it works fine   ( Why doesn't need a
Send wrapper type ? . I guess cause of asm generated itself  but  I
don't know ...)
If I perform a synchronous call with a String as return type  (String
send(String text) ) , it works fine . I mean, asm does its job
generating wrappers in runtime

It's not a problem for me to using my own wrappers types, but I don't
understand ** why CXF cannot cast jaxws_asm.SendResponse to String
when calls handleResponse method **


Thanks and regards