Skip to Content

Need to add namespace to the source structure using Anonymizer Bean

Hi Experts,

Please help me in achieving below issue

In source message we don't have the xml namespace, ns tag, and encoding we need to insert those by using the Anonymizer Bean

Source file

Source Message:

<FL_R_IN_IFD>

<MsgData>

<R_HEADER>

<R_DETAIL>

</R_DETAIL>

</R_HEADER>

</MsgData>

</FL_RA_IN_IFD>

Expected:

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

<ns0:FL_R_IN_IFD xmlns:ns0="http://Test/Test/Test/ECC">

<MsgData>

<R_HEADER>

<R_DETAIL>

</R_DETAIL>

</R_HEADER>

</MsgData>

</ns0:FL_R_IN_IFD>

Please help me

Thanks,

MR

Add comment
10|10000 characters needed characters exceeded

4 Answers

  • Posted on Sep 13, 2015 at 02:16 PM

    Hello Mahi,

    You can use the below XSLT mapping and use it after graphical mapping in OM to add namespace.

    <?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="UTF-8"/>

    <xsl:template match="/">

    <ns0:FL_R_IN_IFD xmlns:ns0="http://Test/Test/Test/ECC">

    <xsl:copy-of select="." />

    </ns0:FL_R_IN_IFD>

    </xsl:template>
    </xsl:stylesheet>

    Or to do the same using beans. Refer the below link

    http://wiki.scn.sap.com/wiki/display/XI/Changing+Namespaces+and+the+encoding+format+of+XML

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 13, 2015 at 05:41 PM

    Did you create your interface structure inside ESR? Then you could remove the XML namespace from message type. Then your graphical mapping tool would work with source message without namespace. The XMLAnonymizerBean does not work for your scenario as expected, so you cannot use it.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 14, 2015 at 05:24 AM

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

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform xmlns:ns0="http://Test/Test/Test/ECC" >

    <xsl:template match="/">

    <xsl:copy-of select=".">

    </xsl:template>

    regards,

    Nikhil Bose

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 14, 2015 at 07:16 AM

    do you want java mapping for that? if yes tell me its a one shot solution but then implementing a java mapping can be a bit cumbersome because you need to compile then make a jar then import and then test it.

    Add comment
    10|10000 characters needed characters exceeded