cancel
Showing results for 
Search instead for 
Did you mean: 

File adapter - change of encoding in the header of the xml message

Former Member
0 Kudos

Hello!

I would like to change the encoding in the header of an xml message (sent to a a receiver file adapter)

from <?xml version="1.0" encoding="UTF-8" ?>

to <?xml version="1.0" encoding="ISO-8859-1" ?>

We have XI 3.0 with SP15.

Can anybody help me please?

Kind regards

Chris

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Chris,

An XSLT map can convert the encoding for you.


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method='xml' encoding="ISO-8859-1"/>

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
  
</xsl:stylesheet>

Thanks,

-Russ

prasad_ulagappan2
Contributor
0 Kudos

As Russ Suggested, it can be done through XSLT mapping or through Java mapping. but when it comes out of integration engine again it will be converted to UTF8. The best approach is to use a adapter module to do this change, so that the adatper will get the XML as UTF8 itself and in adapter you can do a simple java code to change it.

Former Member
0 Kudos

Hi Russ,

thanks for your comment. Isn`t there a possibility to use a module in the processing sequence for this kind of conversion? Or can I use an additional parameter for it?

Kind regards

Chris

Former Member
0 Kudos

Hi Prasad,

If the XSLT to convert the payload encoding is the last map in the interface mapping it will not be converted back to UTF-8 by the file adapter. At least it doesn't on our system.

Thanks,

-Russ

Former Member
0 Kudos

Hi Chris,

I think the module approach Prasad mentioned would require you to create custom module. Prasad, is

that correct? Using a module is an option for sure. For me the XSLT was just easier, but both ways

should work.

Thanks,

-Russ

prasad_ulagappan2
Contributor
0 Kudos

Yes, we need to write a custom module for this. When I tried it with Java mapping (last in interface mapping), it was not working. Anyhow you could try it and let us know.

henrique_pinto
Active Contributor
0 Kudos

Hi Chris,

even though this is not its primary objective, the XMLAnonymizerBean module can be used to change the encoding of an XML file, using the anonymizer.encoding parameter.

Check this out: https://service.sap.com/sap/support/notes/880173

Regards,

Henrique.

Former Member
0 Kudos

Hi Chris

You can change the encoding using XML Anonymizer module in Sender channel.

anonymizer.encoding

can change the encoding for resulting XML.

Refer the Note given by Henrique

Thanks

Gaurav

Answers (0)