My Wrapper类是这样的:
@XmlRootElement(name = "GETA")
public class EfGetAResponseWrapperXmlObject {
private String something;
@XmlElement(name = "result")
public String getSomething() {
return something;
}
public void setSomething(String something) {
this.something = something;
}
}
对于这个包装类,我在SoapUI上得到了这个答案:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:ef_getAresponse xmlns:ns2="http://service.package/">
<ef_get_AReturn><GETA>
<result>mystring</result>
</GETA></ef_get_AReturn>
</ns2:ef_get_AResponse>
</S:Body>
</S:Envelope>
如果我在我的Wrapper类中再引入一个变量:
@XmlRootElement(name = "GETA")
public class EfGetAResponseWrapperXmlObject {
private String something;
private String other;
@XmlElement(name = "result")
public String getSomething() {
return something;
}
public void setSomething(String something) {
this.something = something;
}
public String getOther() {
return other;
}
public void setOther(String other) {
this.other = other;
}
}
我得到了这个答案:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:ef_getAresponse xmlns:ns2="http://service.package/">
<ef_get_AReturn><![CDATA[<GETA>
<result>fasf</result>
<other>fds</other>
</GETA>]]></ef_get_AReturn>
</ns2:ef_getAresponse>
</S:Body>
</S:Envelope>
我不明白这种行为。我希望在第一个案例中得到相同的答案。我怎么能这样做?
答案 0 :(得分:0)
SOAP UI正在这里诀窍。请检查此链接。 http://www.soapui.org/functional-testing/working-with-cdata.html