SAP PI – Changing namespace prefix using XMLAnonymizerBean


SAP PI provides feature of removing, changing or anonymize of namespace prefix from the XML document of the main payload e.g. changing namespace ns0 to ns. This can be achieved by adding XMLAnonymizerBean in the module processor of receiver communication channel.

Use Case

  • You want to define a particular prefix for each namespace before sending out message from Pi.
  • You want to change encoding attribute of XML definition.
  • You want to anonymize XML attributes by removing namespace prefix.

All this is very simple and easy to achieve in PI using XMLAnonymizerBean in the module processor. Read observations section in last of this post to save your time.

Procedure

Go to receiver communication channel of your scenario and select Module tab. Enter following parameters at first index of Processing Sequence table.

  • Module name: AF_Modules/XMLAnonymizerBean
  • Module Type: Local Enterprise Bean.
  • Module Key: 0
Enter Following parameters in Module Configuration Table
Row 1
Row 2
  • Module Key: 0
  • Parameter Name: anonymizer.encoding
  • Parameter Value: E.g. ISO-8859-1
Row 3 (This value is optional)
  • Module Key: 0
  • Parameter Name: anonymizer.quote
  • Parameter Value: ‘ (single quote)
changing-namespace-prefix-using-xmlanonymizerbean1
Observations
  • Go to Run Time Workbench -> Adapter Monitoring -> Communication Channel Monitoring
  • Select your receiver communication channel.
  • Read traces to make sure if Anonymizer bean is being invoked and used by Adapter.
  • Outbound payload message in SXMB_MONI’s central pipeline may still contains namespace prefix. But confirm and verify request received on target system to satisfy that conversion is happening. Reason is that as adapter engine runs on Java stack and PI central pipeline will display outbound message (with prefix) before sending to target adapter.

Let me know for no obligation consulting assistance. Leave your comments for feedback or discussion.

 

1 thought on “SAP PI – Changing namespace prefix using XMLAnonymizerBean

Leave a comment