When i was writing an XML into Oracle Table (column type as XMLTYPE ) its writing without showing any encoding type . This is a current process achieving through Java . We are migrating this process to Mule . In Mule the xml is writing into same table but after writing i see encoding format in that XML . Not sure how its coming , its not there actual xml .
XML in Table when inserting using Java
<?xml version="1.0"?>
When Using Mule
<?xml version="1.0" encoding="US-ASCII"?>
The Code using in Mule to insert XML is below
'REQUEST_XML' : write(payload, 'application/xml'),
This is my insert statement
insert into xmlpkg.REQ_RESP (ID, REQUEST_XML) values (xmlpkg.SEQ_DV.nextval,
:REQUEST_XML )
I giving below in my Input Parameters
{
'REQUEST_XML' : write(payload, 'application/xml')
}
My Payload is an xml but it will come as text , i cannot change it.
<DRIVERequest Version="1.00">
<Authentication PortalID="*****" Password="*******" Username="*******"/>
</DRIVERequest>
This is what i am seeing in log just before the insert operation
Before DB operation : "<?xml version='1.0' encoding='UTF-8'?>\n<DRIVERequest
Version=\"1.00\">\n <Authentication PortalID=\"*****\" Password=\"*******\"
Username=\"*******\"/>\n</DRIVERequest>"
My transformation is
%dw 2.0
output application/json
---
{
requestXML : write(payload, 'application/xml')
}
In Input Arguments i am taking it as below
{
'REQUEST_XML': payload.requestXML
}
In the log i am seeing as UTF-8 but after insert operation its showing as encoding="US-ASCII"
It looks to be that it is not Mule but the Oracle JDBC driver is picking up the wrong encoding somewhere.
Possible solutions: