Skip to Content

How to remove soap envelope, Header and Body from Response message by using xslt mapping

Hi Team,

I am getting the response from external system as below , need to remove the <s:Envelope> <s:Header> and <s:Body> tags from the payload.

we required only the only the actual content present in the <s:Body> tag

Example:

Response Message from external systems:

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

http://www.w3.org/2003/05/soap-envelope" xmlns:a=" http://www.w3.org/2005/08/addressing">

<s:Header>

http://www.textile.com/dataservices/bidata/LogOnResponse>

</s:Header>

<s:Body>

http://www.textile.com/dataservices/bidata/2">

http://www.w3.org/2001/XMLSchema-instance">

<MessageID>1d235a14-eab3-456f-868c-86fe6a8c3e51</MessageID>

</LogOnResult>

</LogOnResponse>

</s:Body>

</s:Envelope>

Requried:

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

http://www.textile.com/dataservices/bidata/2">

http://www.w3.org/2001/XMLSchema-instance">

<MessageID>1d235a14-eab3-456f-868c-86fe6a8c3e51</MessageID>

</LogOnResult>

</LogOnResponse>

Thanks,

Ravi

Add comment
10|10000 characters needed characters exceeded

  • Hi Experts,

    we have removed the Header & Body tags from the response but unable to remove the Envelope tag is also appearing in the content. Please help us to remove the <s:Envelope> tag from the output message.

    xsl code used to remove the tags

    Output generated by the xsl code:

    http://www.w3.org/2003/05/soap-envelope" xmlns:a=" http://www.w3.org/2005/08/addressing"> http://www.ultipro.com/dataservices/bidata/2"> http://www.w3.org/2001/XMLSchema-instance"> f5923f82-e21f-4b79-b911-3ffd33935f73 RP2F1 Ok c3563dd2-f875-4532-bc47-2d6c89155467

    xsl-code.jpg (32.7 kB)
  • Hi Team,

    I am getting the <a:Action> value in the output xml structure. Please help to ignore the value present in the Action tage.

    The action value is Random value.

    we need only the content present in the <LogOnResponse>.......</LogOnResponse>.

    Thanks,

    Ravi

    action-tag.jpg (129.9 kB)
  • Thanks for the support,

    we have resolved the issue..

    Regards,

    Ravi

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Aug 29, 2017 at 08:25 AM

    You could strip them with a simple XSLT mapping like the below:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output indent="yes"/>
        <xsl:template match="@* | node()">
            <xsl:copy>
                <xsl:apply-templates select="@* | node()"/>
            </xsl:copy>
        </xsl:template>
        <xsl:template match="s:*">
            <xsl:apply-templates select="@* | node()"/>
        </xsl:template>
    </xsl:stylesheet>
    

    Untested since what you provided is as far away from valid XML as it gets.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 31, 2017 at 12:45 AM

    Thanks for the support...

    we have resolved the issue

    Add comment
    10|10000 characters needed characters exceeded