I have an issue with some Java first SOAP services implemented using Apache CXF 2.7.11 on Java 8. Value is turning out to be null when TRUE is passed as value. The same is working well when true is passed in lowercase.
I saw another thread where class extending XmlAdapter<String, Boolean>
along with @XmlJavaTypeAdapter
has resolved the issue, However the generated WSDL the type has been changed to xs:string from xs:boolean. Which means the boolean value should be passed as a string by consumer. Which is not acceptable in my case.
JAXB class:
@XmlRootElement(name = "myPojo")
public class MyPojo {
@XmlElement(name = "myField")
private Boolean myBoolean;
@XmlJavaTypeAdapter(CustomBooleanAdapter.class)
public void setMyBoolean(Boolean bool) {
myBoolean = bool;
}
public Boolean getMyBoolean() {
return myBoolean;
}
}
Generated WSDL type
<xs:complexType name="myPojo">
<xs:sequence>
<xs:element minOccurs="0" name="myField" type="xs:string"/>
</xs:sequence>
</xs:complexType>
Now when I run the WSDL2Java on the service the generated class myField would be created as String rather than Boolean.
is there any way to keep the type intact in the generated WSDL?
type="xs:boolean"
)? Or did I misunderstand your question? – Seelenvirtuosetype="xs:string"
. The whole question is about how to gettype="xs:boolean"
generated. – lexicorewsdl2java
which generates the model from a WSDL. Puzzled? Edit: OK. Last sentence speaks about a generated WSDL. Hmmm ... – Seelenvirtuose