on 07-02-2009 11:55 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> 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
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
;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>
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
<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(
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thx for all helpfull replies
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Got one more question
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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)
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.