JAX-WS xsi: missing type attributes
I have a JAX-WS webservice that works great, except that the required xsi: type attributes are missing on the returned elements.
Answer:
<ns1:isUserValidResponse xmlns:ns1="http://www.openuri.org/">
<isUserValidResult>true</isUserValidResult>
</ns1:isUserValidResponse>
desired answer:
<ns:isUserValidResponse xmlns:ns="http://www.openuri.org/">
<isUserValidResult xsi:type="xsd:boolean">true</isUserValidResult>
</ns:isUserValidResponse>
Is there a way to force this behavior?
+3
javajavajava
source
to share
1 answer
I solved this problem by using @XmlAttribute named "xsi: type" and value "xsd: boolean" as shown below. This seems extremely inconvenient to me, but it works on average.
@XmlAttribute(name="xsi:type")
private String xsiType = "xsd:boolean";
0
javajavajava
source
to share