[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] soap:Header update


Subject: Re: [xsl] soap:Header update
From: ram <ram_kurra@xxxxxxxxxxx>
Date: Wed, 14 Mar 2012 02:37:04 +0800 (SGT)

I am sorry Response/output got mixed up. here is my question again.

Request


<s:Envelope
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-u
tility-1.0.xsd" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
	<s:Header>
		<ActivityId CorrelationId="2f96f8f1-7907"
xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">dffb19e
f-7232-4357</ActivityId>
		<o:Security s:mustUnderstand="1"
xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-s
ecext-1.0.xsd">
			<u:Timestamp u:Id="_0">
				<u:Created>2012-03-13T17:55:36.191Z</u:Created>
				<u:Expires>2012-03-13T18:00:36.191Z</u:Expires>
			</u:Timestamp>
		</o:Security>
	</s:Header>
	<s:Body>
		<SearchResponse xmlns="http:/abcd.com/Case">
			<SearchCasesResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:a="http://abcdcom//Response">

			</SearchCasesResult>
		</SearchCasesResponse>
	</s:Body>
</s:Envelope>



Response/output  I am expecting.



<s:Envelope
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-u
tility-1.0.xsd" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" >
	<s:Header>
		<ActivityId CorrelationId="2f96f8f1-7907"
xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">dffb19e
f-7232-4357</ActivityId>
		<o:Security s:mustUnderstand="1"
xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-s
ecext-1.0.xsd">
			<u:Timestamp u:Id="_0">
				<u:Created>2012-03-13T17:55:36.191Z</u:Created>
				<u:Expires>2012-03-13T18:00:36.191Z</u:Expires>
			</u:Timestamp>
		</o:Security>
		<head:ESBHeader xmlns:con="http://abcd.com/head" >
			<head:ESBProps>
				<head:Property>
					<head:name/>
					<head:value/>
				</head:Property>
			</head:ESBProps>
		</head:ESBHeader>
		 <con:Context xmlns:con="http://abcd.com/context">
         <con:CtxProps>
            <con:Property>
          </con:Property>
         </con:CtxProps>
      </con:Context>
	</s:Header>
	<s:Body>
		<SearchResponse xmlns="http:/abcd.com/Case">
			<SearchCasesResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:a="http://abcdcom//Response">

			</SearchCasesResult>
		</SearchCasesResponse>
	</s:Body>
</s:Envelope>



My xslt is overriding the soap header,
 but i wanted to keep the header information and append context and header
elements like above



<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" version="1.0"
xmlns:head="http://abcd.com/header" xmlns:con="http://abcd.com/context" >
	<xsl:output method="xml" indent="yes"/>
	<!-- identity transform -->
	<xsl:template match="@*|node()">
		<xsl:copy>
		<xsl:copy-of
select="document('')/xsl:stylesheet/namespace::*[not(local-name() =
'xsl')]"/>
		<xsl:apply-templates select="@*|node()"/>
		</xsl:copy>
		 <!--  <xsl:copy-of select="/" />-->
	</xsl:template>
	<!-- special handling for soap:Header -->
	<xsl:template match="/*[local-name()='Envelope']/*[local-name()='Header']">

		<soapenv:Header>

	  <xsl:call-template name="ESBHeader"></xsl:call-template>
	  <xsl:call-template name="ContextHeader"></xsl:call-template>


		</soapenv:Header>

	</xsl:template>

	<xsl:template name="ESBHeader">

	<xsl:variable name="Headeradfad">
	  <head:ESBHeader >
			<head:ESBProps>
				<head:Property>
					<head:name/>
					<head:value/>
				</head:Property>
			</head:ESBProps>

		</head:ESBHeader>
	</xsl:variable>
	   <xsl:copy-of select="$Headeradfad"></xsl:copy-of>
	</xsl:template>
	<xsl:template name="ContextHeader">
	<con:Context >

			<con:CtxProps>
				<con:Property>
					<con:name/>
					<con:value/>
				</con:Property>
			</con:CtxProps>
		</con:Context>
	</xsl:template>

</xsl:stylesheet>


Current Thread
Keywords