I am trying to build a simple controller end point to read an XML and output a JSON. The XMLs I am dealing with are quite complex and hence I am doing a schema first approach here I make use of this plugin to generate the pojos with JaxB annotations. It is quite straightforward in Spring Boot 3.4.x where I am able to set up the whole thing within minutes.
However, when trying out the same in micronaut, I keep getting the below error :
"message": "Failed to convert argument [commsHubReq] for value [null] due to: Unexpected end-of-input when trying read value of type `com.mnsmshub.ExtendedData`\n at [Source: (ioty.buffer.ByteBufInputStream); line: 25, column: 19] (through reference chain: com.mnsmshub.CommsHubReq[\"Header\"]->com.mnsmshub.Header[\"actionType\"]->com.mnsmshub.ActionType[\"ExtendedData\"]->java.util.ArrayList[4])"
My XMLs are well formed and so are my POJOs ( they are working without any issues in Spring Boot)
The xml I am using is below :
<NS1:CommsHubReq xmlns:NS1="/">
<NS1:Header>
<NS1:source>TELEPHONE</NS1:source>
<NS1:txnID>3b1c8d9019345def7376609</NS1:txnID>
<NS1:TxnTimestamp>2024-11-19T21:59:03.722Z</NS1:TxnTimestamp>
<NS1:messageType>ORDER_CONFIRMATION</NS1:messageType>
<NS1:actionType>
<NS1:ExtendedData name="sendSMS">N</NS1:ExtendedData>
<NS1:ExtendedData name="sendEmail">Y</NS1:ExtendedData>
</NS1:actionType>
</NS1:Header>
<NS1:Payload>
<NS1:Commshub>
<NS1:customerID>12345</NS1:customerID>
<NS1:subscriberID>[email protected]</NS1:subscriberID>
<NS1:ToEmailAddress>[email protected]</NS1:ToEmailAddress>
<NS1:storeID>10151</NS1:storeID>
<NS1:Language>en</NS1:Language>
<NS1:Country>GB</NS1:Country>
<NS1:channelID>-6</NS1:channelID>
<NS1:MessageDetails>
</NS1:MessageDetails>
</NS1:Commshub>
</NS1:Payload>
</NS1:CommsHubReq>
If I remove the actionType from the XML - parsing is not an issue.
Any help on the same is appreciated. I can share the POJOs that are generated but I feel they might not be an issue.
P.S - The POJO classes all have the below three annotations at class level
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { ""})
@XmlRootElement(name = "")