Hello Experts,

I'm consuming a service which is XML over HTTP. I'm using
org.apache.cxf.jaxrs.client.WebClient to call this service and everything
fine with this implementation for years:

                JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
                org.apache.cxf.jaxrs.client.WebClient webClient = 
bean.createWebClient();
                webClient.post(body);

Now I'm trying to move this client code to spring configuration. I'm using
cxf-3.0.0-milestone2. Following is my client configuration:

        <jaxrs-client:client id="myProvider"
                address="{serviceAddress}"
serviceClass="org.apache.cxf.jaxrs.client.WebClient">
                <jaxrs-client:headers>
                        <entry key="Accept" value="text/xml" />
                </jaxrs-client:headers>
        </jaxrs-client:client>

My Service address is nothing but an ip address and a port. It does not
contain any details about the service name or any other thing.

Here is the code I'm trying to get the client and post request message:

WebClient webClient = (WebClient) getBean("myProvider");

And I'm getting this error:

java.lang.ClassCastException - com.sun.proxy.$Proxy105 cannot be cast to
org.apache.cxf.jaxrs.client.WebClient - java.lang.ClassCastException:
com.sun.proxy.$Proxy105 cannot be cast to
org.apache.cxf.jaxrs.client.WebClient

The reason I need to move my client code to spring/cxf is to add in/out
interceptors. All of my regular jaxws clients are working with spring/cxf
configuration. But only this service is giving me hard time.

My questions are: 
What am I doing wrong here? 
Can't I use jaxrs-client:client for simple XML over HTTP service?

Please note that I was using CXF 2.7.X and jaxrs:client configuration. I was
getting the same error. I switched to CXF 3 after reading about supporting
WebClient in the new version. But the result is same.

Thank you,
Kalpa
 



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Use-jaxrs-client-client-for-XML-over-HTTP-Service-tp5743813.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to