Here, you can use two mechanisms, first you can use Xpath based navigation to get the element you need, or else you can get the header element first, and then UsernameToken element and finally username element.
Deepal On Mon, Jul 26, 2010 at 3:05 PM, hideki tihiri <[email protected]> wrote: > Hi, > I am unable to solve following problem, although it should be fairly simple: > I have folloing SOAP header: > <soapenv:Header xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" > xmlns:wsa="http://www.w3.org/2005/08/addressing"> > <wsse:Security > xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" > soapenv:mustUnderstand="true"> > <wsse:UsernameToken > xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" > wsu:Id="UsernameToken-12592762"> > <wsse:Username>testr</wsse:Username> > <wsse:Password > Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">TEST</wsse:Password> > </wsse:UsernameToken> > </wsse:Security> > <wsa:To>http://localhost:8080/server/services/Remove.RemoveHttpSoap12Endpoint/</wsa:To> > <wsa:MessageID>urn:uuid:40A03A83C5E5358B181280163771513</wsa:MessageID> > <wsa:Action>urn:request</wsa:Action> > </soapenv:Header> > I need to check the username . > I have following code: > MessageContext mc = MessageContext.getCurrentMessageContext(); > SOAPHeader header = mct.getEnvelope().getHeader(); > OMElement headerElem = header.getFirstChildWithName(new > QName("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", > "Username")); > LOGGER.info("wsse-username:" + headerElem.toString()); > > The problem is that a 'null' is logged. > Where do I go wrong ? > Regards, > H. -- http://blogs.deepal.org --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
