getting SOAPBody elements with xsl

W

wsdeveloper

I have a SOAP Message like the following:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="CreateCoordinationContext.xsl"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsa:Action soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">

http://schemas.xmlsoap.org/ws/2004/10/wscoor/CreateCoordinationContext
</wsa:Action>
<wsa:To soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">

http://dutige.st.ewi.tudelft.nl/wstf-coordinator/services/Activation
</wsa:To>
<wsa:ReplyTo soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsa:Address>urn:Initiator</wsa:Address>
</wsa:ReplyTo>
<wsa:MessageID
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
uuid:92f447576866786d:40a96d8e:10631b4fd84:-7fff
</wsa:MessageID>
</soapenv:Header>
<soapenv:Body>
<CreateCoordinationContext
xmlns="http://schemas.xmlsoap.org/ws/2004/10/wscoor">
<Expires>0</Expires>
<CoordinationType>http://schemas.xmlsoap.org/ws/2004/10/wsat</CoordinationType>
</CreateCoordinationContext>
</soapenv:Body>
</soapenv:Envelope>

what i would like to extract is the value of Expires and
CreateCoordinationContext elements but nothing seems to work
i tried the following:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:a="http://schemas.xmlsoap.org/ws/2004/10/wscoor"
exclude-result-prefixes="soapenv" version="1.0">
<xsl:template match="/">
<html>
<body>
<h2>SOAP BODY</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Expires</th>
<th align="left">CoordinationType</th>
</tr>
<tr>
<td>
<xsl:value-of
select="/soapenv:Envelope/soapenv:Body/a:CreateCoordinationContext/a:Expires"/>
</td>
<td>
<xsl:value-of
select="/soapenv:Envelope/soapenv:Body/node()[1]/node()[2]"/>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
but i don't get any answer i don't see where is the problem.
Thanks in advance fo any suggestion.
 
W

wsdeveloper

i have found the error so for anyone intersted i post it here.
first the SOAP should not have any ref to the xsl:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsa:Action
soapenv:mustUnderstand="0"xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">

http://schemas.xmlsoap.org/ws/2004/10/wscoor/CreateCoordinationContext
</wsa:Action>
<wsa:To soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">

http://dutige.st.ewi.tudelft.nl/wstf-coordinator/services/Activation
</wsa:To>
<wsa:ReplyTo soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsa:Address>urn:Initiator</wsa:Address>
</wsa:ReplyTo>
<wsa:MessageID
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
uuid:92f447576866786d:40a96d8e:10631b4fd84:-7fff
</wsa:MessageID>
</soapenv:Header>
<soapenv:Body>
<CreateCoordinationContext
xmlns="http://schemas.xmlsoap.org/ws/2004/10/wscoor">
<Expires>0</Expires>

<CoordinationType>http://schemas.xmlsoap.org/ws/2004/10/wsat</CoordinationType>
</CreateCoordinationContext>
</soapenv:Body>
</soapenv:Envelope>

then the xsl should look like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wscoor="http://schemas.xmlsoap.org/ws/2004/10/wscoor"
exclude-result-prefixes="soapenv" version="1.0">
<xsl:template match="/">
<html>
<body>
<h2>SOAP BODY</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Expires</th>
<th align="left">CoordinationType</th>
</tr>
<tr>
<td>
<xsl:value-of
select="/soapenv:Envelope/soapenv:Body/wscoor:CreateCoordinationContext/wscoor:Expires"/>
</td>
<td>
<xsl:value-of
select="/soapenv:Envelope/soapenv:Body/wscoor:CreateCoordinationContext/wscoor:CoordinationType"/>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

so the different namespaces have to be imported in the xsl.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top