cancel
Showing results for 
Search instead for 
Did you mean: 

Need to add namespace to the source structure using Anonymizer Bean

former_member350687
Participant
0 Kudos

Hi Experts,

Please help me in achieving below issue

In source message we don't have the xml namespace, ns tag, and encoding we need to insert those by using the Anonymizer Bean

Source file

Source Message:

<FL_R_IN_IFD>

   <MsgData>

      <R_HEADER>

         <R_DETAIL>

         </R_DETAIL>

      </R_HEADER>

   </MsgData>

</FL_RA_IN_IFD>

Expected:

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

<ns0:FL_R_IN_IFD xmlns:ns0="http://Test/Test/Test/ECC">

   <MsgData>

      <R_HEADER>

           <R_DETAIL>

           </R_DETAIL>

      </R_HEADER>

   </MsgData>

</ns0:FL_R_IN_IFD>

Please help me

Thanks,

MR

Accepted Solutions (0)

Answers (4)

Answers (4)

vinaymittal
Contributor
0 Kudos

do you want java mapping for that? if yes tell me its a one shot solution but then implementing a java mapping can be a bit cumbersome because you need to compile then make a jar then import and then test it.

nikhil_bose
Active Contributor
0 Kudos

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

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

<xsl:template match="/">

<xsl:copy-of select=".">

</xsl:template>

regards,

Nikhil Bose

stefan_grube
Active Contributor
0 Kudos

Did you create your interface structure inside ESR? Then you could remove the XML namespace from message type. Then your graphical mapping tool would work with source message without namespace. The XMLAnonymizerBean does not work for your scenario as expected, so you cannot use it.

former_member186851
Active Contributor
0 Kudos

Hello Mahi,

You can use the below XSLT mapping and use it after graphical mapping in OM to add namespace.

<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8"/>

<xsl:template match="/">

<ns0:FL_R_IN_IFD xmlns:ns0="http://Test/Test/Test/ECC">

  <xsl:copy-of select="." />

</ns0:FL_R_IN_IFD>

</xsl:template>
</xsl:stylesheet>

Or to do the same using beans. Refer the  below link

http://wiki.scn.sap.com/wiki/display/XI/Changing+Namespaces+and+the+encoding+format+of+XML

former_member350687
Participant
0 Kudos

Hi Raghuraman,

Thank you for quick reply

I add the above code to the Operation Mapping it is failing with below error.

Please check this

former_member186851
Active Contributor
0 Kudos

Hello Mahi,

Sorry, use this XSLT before Graphical mapping.

In the XSLT code did you change as per your message type.

Please try testing in Operation mapping and post the error.

former_member350687
Participant
0 Kudos

Hi Raghuraman,

Do i need to include my complete message type in the code..?

I am providing my message type here please provide the code accordingly

<FL_RA_IN_IFD>

<MsgData>

<RA_HEADER><

ORIGIN>LEGACY</ORIGIN>

<TRAN_DATE></TRAN_DATE>

<TRAN_SEQ>0000001</TRAN_SEQ>

<TRAN_CODE>RA</TRAN_CODE>

<TRAN_VERS>0006</TRAN_VERS>

<TRAN_SEG>0010</TRAN_SEG>

<TRAN_ACT>03</TRAN_ACT>

<RCP_TYP_TXT>DG</RCP_TYP_TXT>

<RA_NUM>856281</RA_NUM>

<VEN_ID>022019</VEN_ID>

<CUS_ID>022019</CUS_ID>

<CUS_NAME>VISKO TEEPAK, LLC</CUS_NAME>

<EXPD_DT/>

<FST_ACPT_DT />

<LST_ACPT_DT />

<ISS_DT />

<RTN_RSN_TXT />

<WH_ID>HQM</WH_ID>

<RA_DETAIL/>

<ORIGIN>LEGACY</ORIGIN>

<TRAN_DATE></TRAN_DATE>

<TRAN_SEQ>0000016</TRAN_SEQ>

<TRAN_CODE>RA</TRAN_CODE>

<TRAN_VERS>0006</TRAN_VERS>

<TRAN_SEG>0030</TRAN_SEG>

<TRAN_ACT>03</TRAN_ACT>

<RCP_TYP_TXT>DG</RCP_TYP_TXT>

<RA_NUM>856281</RA_NUM>

<LINE_NUM>0101</LINE_NUM>

<ITEM_NUM>M83311</ITEM_NUM>

<INV_STAT_TXT />

<QTY>10</QTY>

<CATCH_QTY>0</CATCH_QTY>

</RA_DETAIL>

</RA_HEADER>

</MsgData>

</FL_RA_IN_IFD>

This is complete structure

former_member186851
Active Contributor
0 Kudos

Hello Mahi,

Replace in the place of XXX your message Type Name and YYYY your namespace

<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8"/>

<xsl:template match="/">

<ns0:XXX xmlns:ns0="YYYY">

  <xsl:copy-of select="." />

</ns0:XXX>

</xsl:template>
</xsl:stylesheet>

And use this before the graphical mapping

former_member350687
Participant
0 Kudos

Hi Raghuraman,

I tried as above and it is working partially.

It is generating extra end tags at namespace and the end tag, if we can remove those extra end tags then it is done

please find the below details.

I just executed only XSLT mapping.

Please suggest

former_member186851
Active Contributor
0 Kudos

Mahi,

Try this,

<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8"/>

<xsl:template match="/">

<ns0:XXX xmlns:ns0="YYYY">

  <xsl:copy-of select="//MsgData" />

</ns0:XXX>

</xsl:template>
</xsl:stylesheet>

And one more thing try adding namespace in Message type and check whether it is adding namespace by default/

former_member350687
Participant
0 Kudos

Hi Raghuraman,

No Luck

By using code it is just populating the half of the message.

Please check the attachment.

coming to message type i can see the namespace.

as the source is not sending the namespace we need to add it at our end.

former_member186851
Active Contributor
0 Kudos

Mahi,

I mean the namespace in the Message type. You can find the option below the data type something like default namespace.