Hello, dear.
There is a third-party library (for obvious reasons not modifiable), I inherit my class from one of its abstract classes. Then I serialize this class with JAXB and give it over SOAP (I only connect the enterprise, I don’t pull the libraries separately, everything from the javax package).
Problem: JAXB grabs the fields of an abstract (super) class, which is undesirable (they are not even described in xsd, and therefore are rendered without namespace).
Question: how to ignore all fields of all superclasses, or how to ignore all fields that are not marked with @XmlElement ?
I tried the following:
@XmlAccessorType(XmlAccessType.NONE)to the current class (which, in fact, goes to serialize)- Tried to make an intermediate class, and
@XmlTransienton it - I tried to rewrite the getters of the fields that
@XmlTransientme, and@XmlTransienton them
None of this helps, it feels like JAXB just scored on annotations ...
Here is what I get:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <S:Body> <ns3:GetBonusStatusRequest xmlns:ns3="http://some.soap.wsdl.ru/path/to/them/SelfCarePortal"> <execDelay>0</execDelay> <name>com.xxx.protocol.sip.impl.GetBonusStatusSipRequest</name> <poolId>sip</poolId> <ns3:svcNum>xxxxxx</ns3:svcNum> <ns3:SAN>xxxxxxx</ns3:SAN> </ns3:GetBonusStatusRequest> </S:Body> Accordingly, I do not need the execDelay, name, poolId fields, they are not described by the protocol. Jackson, for example, is able to @JsonIgnoreProperties({"poolId", "frontendId", "name", "execDate", "execDelay", "cancelled"}) but JAXB has pumped something ...