关于jaxb绑定hashmap类型

View: New views
3 Messages — Rating Filter:   Alert me  

关于jaxb绑定hashmap类型

by shurrik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

这里只说输入参数是hashmap类型,返回hashmap类型我倒是解决了,比如服务端的实现类的一个方法为:
@XmlJavaTypeAdapter(HashAdapter.class)
public HashMap locate(@WebParam(name = "obj") HashMap obj) throws
Exception;

客户端如何传值都无法让适配器起效,转成pojo的数组形式,有相关的解决经验么?
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。
 要在此论坛发帖,请发电子邮件到 cxf-zh@...
 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@...
 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛
----
Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index
-~----------~----~----~----~------~----~------~--~---


Re: 关于jaxb绑定hashmap类型

by shurrik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

另外,生成的客户端返回类型不是HashMap,而是pojo的数组,这个也挺郁闷
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。
 要在此论坛发帖,请发电子邮件到 cxf-zh@...
 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@...
 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛
----
Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index
-~----------~----~----~----~------~----~------~--~---


Re: 关于jaxb绑定hashmap类型

by willem.jiang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

JAXB 在缺省情况下是不支持Map的,你需要使用上面的XmlJavaTypeAdapter 标注来提供支持。
如果你是使用code first 开发的话,你可以让客户端直接使用服务器端的SEI。

姜宁 (Willem)
------------------
Apache CXF, Apache Camel committer
Open SOA http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang

On 9月24日, 下午4时43分, shurrik <darkforest...@...> wrote:
> 另外,生成的客户端返回类型不是HashMap,而是pojo的数组,这个也挺郁闷
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。
 要在此论坛发帖,请发电子邮件到 cxf-zh@...
 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@...
 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛
----
Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index
-~----------~----~----~----~------~----~------~--~---