CXF学习04---处理MAP等CXF无法自动转换的复合数据类型的形参和返回值

本文介绍了如何在CXF WebService接口中处理Map等复合数据类型的形参和返回值,通过@XmlJavaTypeAdapter注解配合自定义转换器,实现了CXF无法自动转换的数据类型的支持。
摘要由CSDN通过智能技术生成

当在WebService的接口定义中使用到了Map接口,如下所示

Map<String,Cat> getAllCats();

此时运行服务器端,会报如下错误,指出CXF对Map接口不支持。

2014-5-2 17:11:38 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://impl.cxf.ws.onyas.com/}HelloWorldWs from class com.onyas.ws.cxf.HelloWorld
Exception in thread "main" javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:371)
	at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:251)
	at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:155)
	at javax.xml.ws.Endpoint.publish(Endpoint.java:170)
	at onyas.ServerMain.main(ServerMain.java:13)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:341)
	at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:490)
	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:704)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:550)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
	at org
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值