I am currently marshaling populated xjc classes to an xml file/string using jaxbDataFormat. However only populated fields are printing when I marshal. For example lets say version015v003 has 2 String fields, field1 and field2. I set field1 ="something" but dont set field2. I still want the generated xml to have both field1 and field2. As shown below. Any advice on how to achieve this?
<field1>something</field1>
<field2></field2>
JaxbDataFormat jaxbDataFormat = new JaxbDataFormat("com.ups.brokerage.model.boss.version015v003");
from("direct:convertToEntryPacket")
.routeId("BasXmlTranslation.mapToEntryPacket")
.setExchangePattern(ExchangePattern.InOut)
.bean("logging", "info(*, 'About to convert to entry packet')")
.bean(entryPacketToBasMapper, "mapEntryPacketToBas(*)")
.marshal(jaxbDataFormat)
.bean("logging", "info(*, 'TRANSFORM: entry packet made... Message Body: ${body}')")
.setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200))
.convertBodyTo(String.class);