Skip to Content

SAP PI - How To Add Extra namespace in Receiver File?

Hi All,

This is my first question after SCN upgraded.

I need to add extra namespaces in receiver file.

Now I am getting namespace in output file like below.

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

http://www.oracle.com/retail/integration/other/SupplierMessage">

But my client expecting below.

<?xml version="1.0"?>

http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.oracle.com/retail/integration/other/SupplierMessage" xmlns=" http://www.oracle.com/retail/integration/other/SupplierMessage">

Please help me to get expected namespaces.

Thanks In Advance,

Vishnu.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Oct 14, 2016 at 09:45 AM

    Hi Manoj/Raghu/Evgeniy/Ramkumar,

    XMLAnonymizerBean only to remove the namespace or namespace prefix not to add the new namespace to the XML.

    According to SAP help:

    You use this module to anonymize XML elements and attributes by removing namespaces or namespace prefixes from the XML document of the main payload.

    The module scan each namespace and verifying that the namespace exist in the list of accepted namespaces which is specified in the module configuration, if found then adding it to the output otherwise it is not adding it to the output.

    So we cannot add the new namespace using XMLAnonymizerBean.

    Regards,

    Praveen.


    Add comment
    10|10000 characters needed characters exceeded

    • Yes, it's a nice "trick" but I wouldn't suggest using it as it's undocumented approach.

      I remember the case when I used java code in my UDF based on fact that ResultList class extends standard ArrayList class.

      And in next version SAP developers change it for their own custom class and my code stopped working.

      Regards, Evgeniy.

  • Oct 14, 2016 at 12:45 AM

    XMLAnonymizerBean is capable of retaining the namespace but i dont think it will add new namespace you may try below blog :

    https://blogs.sap.com/2012/11/05/message-mapping-play-around-with-target-structure/

    Br,

    Manoj

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 13, 2016 at 10:19 PM

    Use AF_Modules/XMLAnonymizerBean module in the receiver channel.

    Parameter name – anonymizer.acceptNamespaces

    Refer the blog

    https://blogs.sap.com/2012/07/10/handling-namespaces-in-pi-using-xmlanonymizerbean/

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 14, 2016 at 01:16 AM

    Hi Vishnu!

    You could try with using Manoj's suggestion or use XSL transformation in Operation mapping or in channel using MessageTransformBean.

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Raghu!

      I didn't try XMLAnonymizerBean for custom namespace adding so can't be sure if it works this way.

      Using XSL transformation after the main mapping in OM could be the right approach IMHO.

      Regards, Evgeniy.