Java Generate Soap Envelop Message With Same Element Name With Different Type
I am new to web services. i am writing soap web services. Below is my bean structure which i wrote in web service.
@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;
}
}
When i use wsimport to generate client stub then it says Multiple elements with same name 'command' . But my Soap envelop message should be like below.
<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>
I need to add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:wsCommand" & xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:wsCommandResp" to the elements.
Please help me by providing suggestion.
链接地址: http://www.djcxy.com/p/51726.html上一篇: 如何使用Leiningen运行代码?