Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
arijit_mukherjee2
Participant


Some real time scenario will require to have the specific namespaces as per receiver’s system however while PI does the mapping, it may not generate the payload with the exact/required namespace. In those cases we may need to remove/add/replace namespaces.

SAP has provided one JAVA Bean which could help us in case of removing/replacing namespaces. I have described how this bean can help in removing namespace(or corresponding prefix) at Remove Namespace in PI by XMLAnonymizer Bean in communication channel-Example step by step

 

In this blog we will see how this can help replacing the namespace.

 

We had one scenario where the output after mapping looks like below.



 

However our customer wanted the output like below.

 



So if you notice carefully then we needed below changes.

 

  • Remove the namespace prefix “ns0” however keep the corresponding namespace “urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2”

  • Replace the namespace prefix “ns2” with “cbc”

  • Replace the namespace prefix “ns3” with “cac”.


To do this,we have used the XML Anonymizer bean.

 



 

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:

urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 cbc urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 cac urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2 ''



Please note that in case you have any additional Namespaces and Prefix, you also need to maintain them in the Parameter Value along with the the changes/replacement in the same place. So if you have a namespace like soapenv:http://abc.com and you want to keep that along with above changes then the Parameter Value becomes like below.

http://abc.com soapenv urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 cbc urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 cac urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2 ''



8 Comments
Labels in this area