日期:2014-05-20  浏览次数:20757 次

xfire+spring
xfire+spring 生成的客户端代码的实体bean
Java code
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "EIDUser", propOrder = {
    "password",
    "regTime",
    "username",
    "visible"
})
public class EIDUser {

    @XmlElementRef(name = "password", namespace = "http://user.bean.itdos.net", type = JAXBElement.class)
    protected JAXBElement<String> password;
    protected XMLGregorianCalendar regTime;
    @XmlElementRef(name = "username", namespace = "http://user.bean.itdos.net", type = JAXBElement.class)
    protected JAXBElement<String> username;
    @XmlElementRef(name = "visible", namespace = "http://user.bean.itdos.net", type = JAXBElement.class)
    protected JAXBElement<Boolean> visible;



xfire 生成的客户端代码的实体bean
Java code

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Customer", propOrder = {
    "email",
    "name",
    "phone"
})
public class Customer {

    @XmlElement(required = true)
    protected String email;
    @XmlElement(required = true)
    protected String name;
    @XmlElement(required = true)
    protected String phone;



各位大牛 谁知道怎么回事 什么才能让spring+sfire 生成的代码和 xfire一样

------解决方案--------------------
帮你顶一下吧。这个我确实是不知道。
------解决方案--------------------
AXIS2 + spring自己弄的路过
------解决方案--------------------
一个是动态映射,一个是静态映射(xml element和java bean property之间),可能哪有个开关控制,用都可以用的吧


@Retention(value=RUNTIME)
@Target(value={FIELD,METHOD})
public @interface XmlElementRef

Maps a JavaBean property to a XML element derived from property's type.

Usage

@XmlElementRef annotation can be used with a JavaBean property or from within XmlElementRefs

This annotation dynamically associates an XML element name with the JavaBean property. When a JavaBean property is annotated with XmlElement, the XML element name is statically derived from the JavaBean property name. However, when this annotation is used, the XML element name is derived from the instance of the type of the JavaBean property at runtime.