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 in one of the stackoverflow threads 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 in the generated stub pojo class
myField would be created as String rather than Boolean.
is there any way to keep the type intact in the generated WSDL?