[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

soap:Header update

Subject: soap:Header update
From: ram <ram_kurra@xxxxxxxxxxx>
Date: Wed, 14 Mar 2012 02:30:28 +0800 (SGT)
 soap:Header update
Hi,
    I have a soap response msg with header. i wanted to add the soap header
with new elements along with existing ones.
Here is my 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>


Here is the response that 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><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>


	<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>


I tried with the following peace of code, but its overridding existing
information in the SOAPHeader,
<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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.