cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Adding namespace in xml tag using xslt mapping

manemahesh
Participant
0 Likes
5,588

Hi All,
I have to add namespace in below xml tag:-
Actual xml:-

<sendData>
<MicInterfaceRequest>
  <Connection>
    <connectionID>MICWebService</connectionID>
    <partnerID>MICTest</partnerID>
    <dateTime>2014-02-12T20:00:00.123Z</dateTime>
  </Connection>
</MicInterfaceRequest>

Required xml:-

<MicInterfaceRequest xmlns="urn:http://www.mic-cust.com/Webservice/MicInterface/v1.0">
  <Connection>
    <connectionID>MICWebService</connectionID>
    <partnerID>MICTest</partnerID>
    <dateTime>2014-02-12T20:00:00.123Z</dateTime>
  </Connection>
</MicInterfaceRequest>

Please help how to achieve this using xslt mapping

Regards

Mahesh

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member190293
Active Contributor
0 Likes

Hi Manesh!

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

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

   

     <xsl:output encoding="UTF-8" indent="yes"/>

     <xsl:template match="/*">

          <xsl:element name="{local-name()}" namespace="urn:http://www.mic-cust.com/Webservice/MicInterface/v1.0">

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

          </xsl:element>

     </xsl:template>

</xsl:stylesheet>

Regards, Evgeniy.

manoj_khavatkopp
Active Contributor
0 Likes
Former Member
0 Likes

Manoj adding in message type will work right?

manoj_khavatkopp
Active Contributor
0 Likes

Raghu,

By looking at the XML itseems he's dealing with WSDl file and not message type.

If message type is created then yes your suggestion would work.

Br,

Manoj

manemahesh
Participant
0 Likes

Hi Manoj,

Yes I m dealing with WSDL file.

And code given in below link help just required some little change in that.

https://scn.sap.com/thread/2062939

Thanks

Former Member
0 Likes


Mahesh,

Pose the code your using

manoj_khavatkopp
Active Contributor
0 Likes

Any reason why u r not using the UDF and going for XSLT ?

Former Member
0 Likes

Hello Mahesh,

Try adding the XML namespace in the Message type.

And for XSLT check the below link

add Namespace in message mapping | SCN

manemahesh
Participant
0 Likes

Hi Sritharan,

link you have given is used and its creating node as below :-

e.g.

<MicInterfaceRequest xmlns="urn:http://www.mic-cust.com/Webservice/MicInterface/v1.0">

<MicInterfaceRequest>    

  <Connection>

    <connectionID>MICWebService</connectionID>

    <partnerID>MICTest</partnerID>

    <dateTime>2014-02-12T20:00:00.123Z</dateTime>

  </Connection>

</MicInterfaceRequest>

which is not expected.

Former Member
0 Likes

Hello Mahesh,

Did you add the namespace in the message type and check?

Former Member