Skip to Content
0

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

Aug 29, 2017 at 06:43 AM

304

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
Former Member

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)
0
Former Member
Former Member

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)
0
Former Member

Thanks for the support,

we have resolved the issue..

Regards,

Ravi

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

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

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.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Patrick,

Need to remove the Envelope,Header and Body form the response message.

Input Message

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

<s:Header>

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

</s:Header>

<s:Body>

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

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

<ServiceId>f5923f82- e21f-4b79-b911-3ffd33935f73</ServiceId>

<Client>AFS</Client>

<EmployeeID>4566bf45</EmployeeID>

<Status>Ok</Status>

</LogOnResult>

</LogOnResponse>

</s:Body>

</s:Envelope>

The expected output as PI structure:.

http://www.textile.com/dataservices/bidata/2"> f5923f82- e21f-4b79-b911-3ffd33935f73</ns0:ServiceId> <ns0:Client>AFS</ns0:Client> <ns0:EmployeeID>4566bf45t</ns0:EmployeeID> <ns0:Status>Ok</ns0:Status> </ns0:LogOnResult> </ns0:LogOnResponse>

Thanks,

Ravi

logonresponse.jpg (32.4 kB)
0
Former Member
Former Member

Hi Experts,

High priority issue...

Please help to get the LogOnRespone data as xml content.

we are using the below code to get the result:

http://www.w3.org/1999/XSL/Transform" xmlns:s=" http://www.w3.org/2003/05/soap-envelope">

Regards,

Ravi

0
avatar image
Former Member Aug 31, 2017 at 12:45 AM
0

Thanks for the support...

we have resolved the issue

Share
10 |10000 characters needed characters left characters exceeded