cancel
Showing results for 
Search instead for 
Did you mean: 

Remove SOAP Envelope XSLT not working as expected

former_member181962
Active Contributor
0 Kudos

Hi all,

I am trying to create a XSLT mapping to remove the SOAP envelope from an XML input payload.

Here is the code that i use:

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

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="ns0:Body">

<xsl:copy-of select="child::node()"/>

</xsl:template>

</xsl:stylesheet>

The Input is:

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

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:typ="http://jobs.ws.XXXXXX.com/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<soapenv:Header>

<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">

<wsu:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">

  <wsse:Password>XXXXXXXX</wsse:Password>

  <wsse:Username>YYYYYYYY</wsse:Username>

  </wsu:UsernameToken>

  </wsse:Security>

  </soapenv:Header>

<soapenv:Body>

<typ:scheduleDataFlow>

<df>

  <confName xsi:type="xsd:string">ABC</confName>

  <ownerName xsi:type="xsd:string">OWNER</ownerName>

  <orgName xsi:type="xsd:string">XYZ</orgName>

  </df>

  </typ:scheduleDataFlow>

  </soapenv:Body>

  </soapenv:Envelope>

The output is:

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

  XXXXXXXX

YYYYYYYY

  <typ:scheduleDataFlow xmlns:typ="http://jobs.ws.XXXXXX.com/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<df>

  <confName xsi:type="xsd:string">ABC</confName>

  <ownerName xsi:type="xsd:string">OWNER</ownerName>

  <orgName xsi:type="xsd:string">XYZ</orgName>

  </df>

  </typ:scheduleDataFlow>

 

As you can see i get the extra lines (lines 2 and 3, which is causing XML parser errors.

Can you please help me out?

Best Regards,

Ravi

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member181962
Active Contributor
0 Kudos

I have used an alternative approach (Another XSLT). Will update the post soon.

Former Member
0 Kudos

How did you end up achieving the removal of username/password from the SOAP header in XSLT? I'm facing a similar issue.