简体   繁体   English

JAX-WS规范以及对JAXB批注的需求

[英]JAX-WS specification and the need for JAXB annotations

I always thought that to bind beans to SOAP messages in JAX-WS we need to use JAXB bindings. 我一直认为,要在JAX-WS中将bean绑定到SOAP消息,我们需要使用JAXB绑定。

Recently I was able to send and receive complex beans without the need of any JAXB annotations using Metro implementation. 最近,我可以使用Metro实现发送和接收复杂的bean,而无需任何JAXB批注。

Is this a new feature introduced in the latest specification or was it like this from the start? 这是最新规范中引入的一项新功能,还是一开始就是这样?

There are default behaviours that JAXB will use to map classes that aren't annotated. JAXB将使用默认行为来映射未注释的类。 You only need annotations if the mapping you want to define doesn't follow these defaults (eg if you want to map anything to attributes rather than elements, or override the element names, add wrapper elements round collections, etc.). 仅当要定义的映射不遵循这些默认值时,才需要注释(例如,如果要将任何内容映射到属性而不是元素,或覆盖元素名称,将包装器元素添加到集合中,等等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM