Skip to Content

We may have to nurture with the namespaces in the payload before posting to the end system.The requirement could be to remove namespace prefix in XML Payload.This module then can help the developer without writing long XSLT codes to achieve the result.

First let us understand the basics of Namespace.

What is a namespace?

Ans:XML namespaces are used for providing uniquely named elements and attributes in an XML document.


Ans:XML namespace is to avoid naming conflicts when using and re-using multiple times.

How we use it in the XML?

Ans:Example below.

<ns0:table xmlns:ns0=>

In the attribute xmlns:ns0, xmlns is a reserved word, used to declare a namespace. That is the above example is read as binding the prefix ‘ns0’ with the namespace ‘

Now let us see the use of the XML Anonymizer Bean in real case.

We had a scenario where the output was like below after the mapping in PI.

<?xml version=“1.0” encoding=“UTF-8”?>
<soap:Envelope xmlns:soap= xmlns:xsd= xmlns:xsi=>
<ns1:ImportString xmlns:ns1=>

However the customer wanted us to remove the prefix of ns1 without removing the namespace.However they wanted the soap,xsd and xsi prefix and namespace both to be there at the output. So they wanted a structure  like below.

<?xml version=“1.0” encoding=“UTF-8”?>
<soap:Envelope xmlns:soap= xmlns:xsd= xmlns:xsi=>
<ImportString xmlns=>

To do this we had to use the XML Anonymizer Bean like below


Here is the configuration procedure:

  • Add the Module in the Processing Sequence.Insert this Anonymizer module before the adapter module as shown above.

Module Name : AF_Modules/XMLAnonymizerBean

Module Type:Local Enerprise Bean

Module Key: 0

The module name ‘CallSapAdapter’ is default one that can be left as it is

  • Add Parameters in the Module Configuration.

Module Key: 0

Parameter Name: anonymizer.acceptNamespaces

Parameter Value: xsi xsd soap

Enter a list of namespaces and their prefixes that are to be kept in the target XML document and to result a namespace without a prefix, enter ” (two single quotation marks). 

Module Key: 0

Parameter Name: anonymizer.quote

Parameter Value:

Here specify the character to be used to enclose the attribute values.  The default value is ‘. 

Once we activate all the above configurations and execute the scenario we get the desired output as below.

<soap:Envelope xmlns:soap= xmlns:xsd= xmlns:xsi=>
<ImportString xmlns=>

Now how to replace namespace? Check this Replace Namespace in PI by XMLAnonymizer Bean in communication channel-Example step by step

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

    1. Arijit Mukherjee Post author

      Hi Avinash,

      In our requirement we needed to keep the below prefix and namespaces.




      However we were asked to remove the prefix “ns1” but keep the corresponding namespace.


      And as per the rule,you need to mention the namespaces and their prefix separated by a space if you want to keep them at output. And if you want a namespace without a prefix, enter ” (two single quotation marks). So we had to form the below value for that parameter. xsi xsd

      If you notice carefully then you can see I have written all the namespace and prefix pair separated by space, whom I needed to get in the output and for the one where the prefix were needed to be suppressed,I mentioned ” in the place of prefix for its corresponding namespace.



          1. Mohith M

            Hi Arijit,

            My requirement is to remove the header information in the soap envelope.

            In soap header i am getting some dummy data from source side.Is there ant chance to remove soap header with XMLAnonymizerBean.


                Hi Arjit,

                Does this XML anonymizer bean works to remove namespace for SOAP Body element ?In your example to remove xmlns= ?In my case the SOAP body element has <ns0:Element xmlns:ns0=””> I need to remove the namespace but needs to replace the prefix ns0 with wfm for all the elements in the SOAP Body .

                Could you please let me know how we can do this?

                Thanks and Regards,

  1. RaviTeja M

    Hi Team,


    Have the similar requirement and configured the Module parameters in JMS sender adapter. The prefix started with <ncr:LineItemItems>6</ncr:LineItemItems> are removed by the module parameters but in the main tag the “xmlns” & “xsi” namespaces are missing in the ouput xml.


    Please help us to get the main tag with the namespaces.



    Input xml:

    <?xml version=”1.0″ encoding=”utf-8″?>
    <POSLog xmlns:xsi=”” xmlns:dsr=”” xsi:schemaLocation=” POSLog.xsd DSRPOSLog.xsd” xmlns=””>
    <Transaction CancelFlag=”false” TrainingModeFlag=”false”>
    <UnitID Name=”1101″ TypeCode=”RetailStore”>Store_1101</UnitID>



    Module Configurations in JMS sender adapter:


    Output Message:

    <?xml version=’1.0′ encoding=’utf-8′?>
    <POSLog schemaLocation=’ POSLog.xsd NCRPOSLog.xsd’>
    <Transaction CancelFlag=’false’ TrainingModeFlag=’false’>



    Namespaces are missing in the output messages the POSLog message.

    Please help us to get the actual namespaces in the output message genearated by JMS sender adapter.












Leave a Reply