cancel
Showing results for 
Search instead for 
Did you mean: 

Change namespace prefix and change xml encoding

Former Member
0 Kudos

I have a file to SOAP scenario,

Currently I am sending XML to the target system as below.

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

- <ns1:mensagemCliente xmlns:ns1="http://bancoconveniado/mensagemCliente">

- <cabecalho>

<dataHoraRequisicao>2012/08/27</dataHoraRequisicao>

</cabecalho>

</ns1:mensagemCliente>

What I need is to send xml to the target system as

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

- <itg:mensagemCliente xmlns:ns1="http://bancoconveniado/mensagemCliente">

- <cabecalho>

<dataHoraRequisicao>2012/08/27</dataHoraRequisicao>

</cabecalho>

</itg:mensagemCliente>

All I need to do is change the namespace prefix from ns1 to itg.

I have created a message type (mensagemCliente) using the sample xml provide by partner. Partner do not have any wsdl/xsd to share so cannot create external definition.

I have referred to Stefan’s blog and used XMLAnonymizerbean in my received SOAP communication channel module configuration.

http://scn.sap.com/people/stefan.grube/blog/2007/02/02/remove-namespace-prefix-or-change-xml-encodin...

Below is my module configuration in receiver SOAP Channel.

But it seems to be not working, as still I am getting the xml with old namespace prefix (ns1).

Also encoding also remains same (UTF-8). I tried to use XMLAnonymizerbean after default module XISOAPAdapterBean as well. But it didn’t work either way.

Is there anything I need to prior to using modules? Or SOAP received does not support XMLAnonymizerbean?

Or any other suggestion how this can be achieved?

Note: we are on PI 7.30

Accepted Solutions (1)

Accepted Solutions (1)

former_member184681
Active Contributor
0 Kudos

Hi,

Have a look at SAP Note 880173 - XI 3.0 Adapter Framework XML Anonymizer Module, especially Example 3, which covers exactly your requirement of changing namespace prefix and encoding.

Regards,

Greg

Former Member
0 Kudos

Hi Greg,
Thanks for quick response.

i already checked this note 880173 and yes, example 3 is exactly what i need to do.
And i have used the module as mentioned in the note in my receiver SOAP communication channel.
Not sure why this is not working ? Any checks i need to do ?

udo_martens
Active Contributor
0 Kudos

Hi,

the module should work.

If you struggle you can use a xsl as alternative. 

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

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

<xsl:template match="*">

  <itg:mensagemCliente xmlns:itg="http://bancoconveniado/mensagemCliente">

   <cabecalho>

    <dataHoraRequisicao>

     <xsl:value-of select="//dataHoraRequisicao"/>

    </dataHoraRequisicao>

   </cabecalho>

  </itg:mensagemCliente>

</xsl:template>

</xsl:stylesheet>

Your example has actually a little mistake, the namespace definition should look like:

xmlns:itg="http://bancoconveniado/mensagemCliente"

Regards,

Udo

Former Member
0 Kudos

using XSLT solved the problem. But i preferred to do it adapter module only as i am already using java and graphical mapping in this interface.

Answers (1)

Answers (1)

Former Member
0 Kudos

Can anyone help with why Adapter Framework XML Anonymizer Module is not working on PI 7.3 ?

Audit log in Channel have entry saying Anonymized successfully.