我是网络服务新手。我正在写肥皂网服务。下面是我在Web服务中编写的bean结构。
@XmlRootElement(name="processRequest")
@XmlAccessorType(value=XmlAccessType.FIELD)
public class RequestDO {
@XmlElement(name="command", type=Common.class)
private List<Common> commonList = null;
@XmlElement(name="command",type=Output.class)
private List<Output> outputList = null;
public List<Common> getCommonList() {
return commonList;
}
public void setCommonList(
List<Common> commonList) {
this.commonList = commonList;
}
public List<PremiumInputCalcDO> getOutputList() {
return outputList;
}
public void setOutputList(
List<Output> commonList) {
this.commonList = commonList;
}
}
当我使用wsimport生成客户端存根时,它会显示具有相同名称的多个元素'command'。但是我的Soap信封应该如下所示。
<S:Envelope> <S:Body>
// List of common fields will be here
<command xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:wsCommand">
<field>DATE</field>
<value>20170101</value>
</command>
// List of output/result fields will be here
<command xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:wsCommandResp">
<txnAmt>100.00</txnAmt>
</command>
</S:Body>
</S:Envelope>
我需要添加xmlns:xsi =“http://www.w3.org/2001/XMLSchema-instance”xsi:type =“ns2:wsCommand”&amp; xmlns:xsi =“http://www.w3.org/2001/XMLSchema-instance”xsi:type =“ns2:wsCommandResp”到元素。
请提供建议帮助我。