开发者

Apache CXF client and Collection classes

I have a requirement to return List of custom class(FeedMetaData) objects from a web service method. When I invoke this method from client, I am getting ClassCast Exception.

FeedMetaData is simple bean class with 3 fields of type String.

Below is the client code:

Bus bus = new CXFBusFactory().createBus();
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(bus);
Client client = dcf.createClient("http://64.68.163.33:8080/socialkast-web/skservice/skservice?wsdl");
Object[] results = client.invoke("getCommecialFeeds");
List<FeedMetaData> result = (List<FeedMetaData>)results[0];

I looked into the issue https://issues.apache.org/jira/browse/CXF-2415

but looks like it only works with list of only objects of java build in classes.

Anyone tried using list of objects of custom classes as return type from a cxf web开发者_JAVA百科 service method.


I came across the exact same issue. this post helped me out in overcoming the issue : http://dhruba.name/2008/12/08/rest-service-example-using-cxf-22-jax-rs-10-jaxb-and-spring/


I am returning a collection of custom classes from my SOAP service.

I created a client with maven wsdl2java and It's working fine. wsdl2java created all those classes for me(including the custom class whose list is being returned).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜