cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ronanf <ronan.fleetw...@yahoo.com>
Subject Re: List parameters appearing with no entries on server side
Date Tue, 29 Jan 2008 17:38:27 GMT

After further investigation the problem resides in the wsdl2Java-generated
Java class for the operation.
The class looks like this:

/**
 * <p>Java class for createMsg complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained
within this class.
 * 
 * <pre>
 * &lt;complexType name="createMsg">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="parentFolderId"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="msgHolder"
type="{http://ws.mstore.common.magoosoft.com/}MStoreMsgHolder"
minOccurs="0"/>
 *         &lt;element name="cContentList"
type="{http://ws.mstore.common.magoosoft.com/}MStoreMsgContentHolder"
maxOccurs="unbounded" minOccurs="0"/>
 *         &lt;element name="cAttachmentList"
type="{http://ws.mstore.common.magoosoft.com/}MStoreMsgAttachmentHolder"
maxOccurs="unbounded" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "createMsg", propOrder = {
    "parentFolderId",
    "msgHolder",
    "cContentList",
    "cAttachmentList"
})
public class CreateMsg {

    protected String parentFolderId;
    protected MStoreMsgHolder msgHolder;
    @XmlElement(required = true)
    protected List<MStoreMsgContentHolder> cContentList;
    @XmlElement(required = true)
    protected List<MStoreMsgAttachmentHolder> cAttachmentList;

    /**
     * Gets the value of the parentFolderId property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getParentFolderId() {
        return parentFolderId;
    }

    /**
     * Sets the value of the parentFolderId property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setParentFolderId(String value) {
        this.parentFolderId = value;
    }

    /**
     * Gets the value of the msgHolder property.
     * 
     * @return
     *     possible object is
     *     {@link MStoreMsgHolder }
     *     
     */
    public MStoreMsgHolder getMsgHolder() {
        return msgHolder;
    }

    /**
     * Sets the value of the msgHolder property.
     * 
     * @param value
     *     allowed object is
     *     {@link MStoreMsgHolder }
     *     
     */
    public void setMsgHolder(MStoreMsgHolder value) {
        this.msgHolder = value;
    }

    /**
     * Gets the value of the cContentList property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the
cContentList property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getCContentList().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link MStoreMsgContentHolder }
     * 
     * 
     */
    public List<MStoreMsgContentHolder> getCContentList() {
        if (cContentList == null) {
            cContentList = new ArrayList<MStoreMsgContentHolder>();
        }
        return this.cContentList;
    }

    /**
     * Gets the value of the cAttachmentList property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the
cAttachmentList property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getCAttachmentList().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link MStoreMsgAttachmentHolder }
     * 
     * 
     */
    public List<MStoreMsgAttachmentHolder> getCAttachmentList() {
        if (cAttachmentList == null) {
            cAttachmentList = new ArrayList<MStoreMsgAttachmentHolder>();
        }
        return this.cAttachmentList;
    }

}


The problem occurs because when the client is calling the server the code in
WrapperHelper.createWrapperObject() fails to add the Lists to the object
because there is no setter and because there is no Field objects for the
cContentList and cAttachmentList fields in WrapperHelper.fields.

One temporary solution is simply to add setters to the generated class but
they will be overwritten the next time the code is generated.

Another solution is to add the name attribute to the List fields on
CreateMsg like this:

    @XmlElement(name = "cContentList", required = true)
    protected List<MStoreMsgContentHolder> cContentList;
    @XmlElement(name = "cAttachmentList", required = true)
    protected List<MStoreMsgAttachmentHolder> cAttachmentList;

This will cause WrapperHelper.createWrapperHelper() to correctly set the
fields field so that the cContentList and cAttachmentList values get set
correctly in WrapperHelper.createWrapperObject().

But again this is not satifactory because the generated code will get
overwritten.

Is there some tag/attribute/property I can set in the WSDL to make the name
attribute get written in the @XmlElement in the generated class?

Regards,
Ronan
-- 
View this message in context: http://www.nabble.com/List-parameters-appearing-with-no-entries-on-server-side-tp15142470p15164982.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message