[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: adding element in with general namespace prefix
i completly agree with you, but some time service provider may not like it when he sees the request, he may question, why are you keeping different namespace prefix for same namespace. i wanted to be consistent in the entire soap request that i am sending --- On Thu, 9/2/12, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote: > From: G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> > Subject: Re: adding element in with general namespace prefix > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx, xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Date: Thursday, 9 February, 2012, 3:11 AM > A true XML application ignores the > namespace prefix and relies only > on the namespace URI associated with the namespace prefix. > > Can you explain why it is important to you that the prefix > be the > same? It is irrelevant. This request is > equivalent to an XML-based > namespace-aware application: > > <giraffe:Envelope xmlns:giraffe="http://schemas.xmlsoap.org/soap/envelope/"> > > An XML application will still see the above as a SOAP > envelope. > > At 2012-02-09 03:06 +0530, ram wrote: > > So any idea how to fix > it. > > It isn't broken. > > I hope this helps. > > . . . . . . . . . . Ken > > At 2012-02-09 03:06 +0530, ram wrote: > >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-wssecuri ty-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-wssecuri ty-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. > > > -- > Contact us for world-wide XML consulting and instructor-led > training > Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/uoui9h > Crane Softwrights Ltd. > http://www.CraneSoftwrights.com/s/ > G. Ken Holman > mailto:gkholman@xxxxxxxxxxxxxxxxxxxx > Google+ profile: https://plus.google.com/116832879756988317389/about > Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|