Do not enter CDATA with a single value

The My Wrapper class is as follows:

@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; } } 

For this shell class, I get this answer on SoapUI:

 <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:ef_getAresponse xmlns:ns2="http://service.package/"> <ef_get_AReturn>&lt;GETA> &lt;result>mystring&lt;/result> &lt;/GETA></ef_get_AReturn> </ns2:ef_get_AResponse> </S:Body> </S:Envelope> 

If I add another variable to the Wrapper class:

 @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; } } 

I get the answer:

 <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> 

I do not understand this behavior. I want to get the same answer in the first case as in the second case. How can i do this?

+8
java cdata web-services soapui
source share
1 answer

The SOAP user interface does this trick. check out this link. http://www.soapui.org/functional-testing/working-with-cdata.html

0
source share

All Articles