cancel
Showing results for 
Search instead for 
Did you mean: 

Remove SOAP-ENV tags from xml RECEIVER RESPONSE payload (XSL needed?)

Former Member
0 Kudos

Hi

I need to remove some tags from the payload of a RESPONSE message in a SOAP webservice scenarion.

The received payload looks like this:

-


before -


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

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://tempuri.org/what.xsd">

<SOAP-ENV:Body>

<ns:crejob-resp>

<response-data>

<Result>0</Result>

</response-data>

</ns:crejob-resp>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

after it should look like this

-


after -


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

<crejob-resp>

<response-data>

<Result>0</Result>

</response-data>

</crejob-resp>

-


I was thinking of using XSL as a "pre-burner" step before my mapping program but need help to XSL on this.

Hope somebody can help

Cheers

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

sure XSLT is a good option here. Done this kind of mappings to eleminate SOAP envelops using XSLT myself a couple of times and it worked out well! Other option would be a JAVA mapping you would have to write - but XSLT is easier I guess.

Regards,

Kai

Former Member
0 Kudos

>

> sure XSLT is a good option here. Done this kind of mappings to eleminate SOAP envelops using XSLT myself a couple of times and it worked out well! Other option would be a JAVA mapping you would have to write - but XSLT is easier I guess.

> Kai

could you supply me with and example on how remove the "HEADER"/namespace tags = <SOAP-ENV:Envelope...>? I am XSL newbie so hope some can help

Cheers

Former Member
0 Kudos

Yes, try this one:

<xsl:stylesheet version = '1.0'

xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="/">

<ns:crejob-resp>

<xsl:value-of select="//crejob-resp"/>

<response-data>

<xsl:value-of select="//response-data"/>

<Result>

<xsl:value-of select="//Result"/>

</Result>

</response-data>

</crejob-resp>

</xsl:template>

</xsl:stylesheet>

Also check http://www.w3schools.com/xsl/default.asp or http://www.w3.org/Style/XSL/ for examples and tutorials.

Kai

Edited by: Kai Lerch-Baier on Jul 2, 2009 2:11 PM

Edited by: Kai Lerch-Baier on Jul 2, 2009 2:12 PM

Former Member
0 Kudos

ahh almost there.

I am getting

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

<ns:crejob-resp xmlns:ns="">

<response-data>0<Result>0</Result>

</response-data>

</ns:crejob-resp>

so the value "0" pops up between response-data and Result - should only be between Result

Hope u can help

Former Member
0 Kudos

;o) each copy and paste should be done carefully - try this

<xsl:stylesheet version = '1.0'

xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="/">

<crejob-resp>

<xsl:value-of select="//ns:crejob-resp"/>

<response-data>

<xsl:value-of select="//response-data"/>

<Result>

<xsl:value-of select="//Result"/>

</Result>

</response-data>

</crejob-resp>

</xsl:template>

</xsl:stylesheet>

or just

<xsl:stylesheet version = '1.0'

xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="/">

<crejob-resp>

<xsl:value-of select="//ns:crejob-resp"/>

</crejob-resp>

</xsl:template>

</xsl:stylesheet>

Former Member
0 Kudos

Bowie

Remove the 7th line in the xsl mapping. The line which has //response-data. Uwill hv as expected.

Regards,

---Satish

Former Member
0 Kudos

I am sorry to be such a pain in the a..

But I still get the wrong result (with your first option, 2nd option is not working):

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

<crejob-resp>

<response-data>0<Result>0</Result></response-data>

</crejob-resp>

Hope u can help again

and also my source can look like: (unbounded on response-data)

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

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://tempuri.org/what.xsd">

<SOAP-ENV:Body>

<ns:crejob-resp>

<response-data>

<Result>0</Result>

</response-data>

<response-data>

<Result>1</Result>

</response-data>

<response-data>

<Result>2</Result>

</response-data>

</ns:crejob-resp>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Edited by: Bowie on Jul 2, 2009 3:08 PM

Former Member
0 Kudos

<xsl:stylesheet version = '1.0'

xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="/">

<crejob-resp>

<response-data>

<Result>

<xsl:value-of select="//Result"/>

</Result>

</response-data>

</crejob-resp>

</xsl:template>

</xsl:stylesheet>

That's it - sorry, but I don't have a tool like XML SPy here at the moment :o(

Answers (4)

Answers (4)

suchitatomar
Participant
0 Kudos

Hi All,

I have a requirement very similar to this and have source and target Soap envelope structure. Need your inputs to develop XSLT code for same as previously this was handled by senderJMS in module tab(Remove Soap envelope) and receiverJMS in Module tab(Create Soap envelope) so XSLT code to be written to handle this functionality in ESR such that these modules can be eliminated from ID.

Former Member
0 Kudos

Thx for all helpfull replies

Former Member
0 Kudos

Got one more question

Former Member
0 Kudos

Hi Thanks Kai, I really appreciate your help.

I got one final question I hope you or somebody else can help with:

what if my responsedata is "unbounded" - how would my XSL then look?

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

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://tempuri.org/what.xsd">

<SOAP-ENV:Body>

<ns:crejob-resp>

<response-data>

<Result>0</Result>

</response-data>

<response-data>

<Result>1</Result>

</response-data>

<response-data>

<Result>2</Result>

</response-data>

</ns:crejob-resp>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Cheers

Edited by: Bowie on Jul 2, 2009 3:51 PM

Former Member
0 Kudos

You would need to insert like this:

....

<xsl:for-each select="//response-data">

<result>

<xsl:value-of select="//result"/>

</result>

</xsl:for-each>

....

check: http://www.w3schools.com/Xsl/xsl_for_each.asp

;o)

Former Member
0 Kudos

Hi Bowie!

Are you really sure that the SOAP envelope is part of the payload? Normally the SOAP envelope is removed by the PI unless you have defined to keep the SOAP header in your comm. channel.

But even if this is true you can still use graphical mapping to remove the SOAP envelope (if your structures are defined to have an envelope). Ohterwise XSTL is the toll of your choice.

Regards,

Volker.