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

adding element in with general namespace prefix

Subject: adding element in with general namespace prefix
From: ram <ram_kurra@xxxxxxxxxxx>
Date: Thu, 9 Feb 2012 03:06:06 +0530 (IST)
 adding element in with general namespace prefix
Hi,
   I have a soap request like the following
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:con1="http://abc.com/DefService/" >
	<soapenv:Header>

         </soapenv:Header>
	<soapenv:Body>
		<con1:GetDefinition>
			<!--Optional:-->
			<con1:Request><con1:Id/>
			</con1:Request>
		</con1:GetDefinition>
	</soapenv:Body>
</soapenv:Envelope>

I wanted to add ws:security with username credentials to the request like the
following.



<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:con="http://wellpoint.com/esb/context"
xmlns:con1="http://abc.com/DefService/>
<soapenv:Header>
<wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-secext-1.0.xsd">
 <wsse:UsernameToken>
   <wsse:Username>abcd</wsse:Username>
   <wsse:Password>ramkurra</wsse:Password>
 </wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
   <con1:GetDefinition>
	<con1:Id/>
	</con1:Response>
   </con1:GetDefinition>
</soapenv:Body>
</soapenv:Envelope>


i tried with the following piece of code

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
    <xsl:copy>
	<xsl:apply-templates select="@*|node()"/>
   </xsl:copy>

</xsl:template>
<xsl:template match="/*[local-name()='Envelope']/*[local-name()='Header']">
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-secext-1.0.xsd">
<wsse:UsernameToken>
   <wsse:Username>	abc</wsse:Username>
   <wsse:Password>	xya</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
</xsl:template>
</xsl:stylesheet>

    i get the result as expected, but my problem is when client sends the
request with different namespace name rather than soapenv:Header, like
s:Header, the following line of code will still put soapenv:Header in the
result
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

   I wanted to make this namespace prefix is more of generalized manner, which
picks from request.
      So any idea how to fix it.

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.