axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hideki tihiri <hideki.tih...@gmail.com>
Subject How to get attribute from SOAPHeader with header.getFirstChildWithName()
Date Mon, 26 Jul 2010 19:05:13 GMT
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.

Mime
View raw message