I'm working with spring-ws, I need to perform simple username and password validation on my webservice calls. For that, I need to obtain the default soap header attributes for username and password. I have no idea how to do that with spring-ws and I've spent a lot of time trying to figure it out.
I'm using SoapUI and sending the username and password by setting them in the "Aut" tab.
My interceptor intercepts my calls, but I've debugged the messageContext and I have no idea where those fields are.
This is my code, it never enters to the code in the while, so the iterator is return false in the hasNext.
@Override
public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception {
logger.info("Intercepting call");
SoapMessage soapMessage = (SoapMessage) messageContext.getRequest();
SoapHeader soapHeader = soapMessage.getSoapHeader();
Iterator<SoapHeaderElement> it = soapHeader.examineAllHeaderElements();
while(it.hasNext()) {
SoapHeaderElement element = it.next();
QName qname = element.getName();
logger.info("QName: " + qname.getLocalPart());
logger.info("Value? " + soapHeader.getAttributeValue(qname));
}
return true;
}
If you would kindly point me towards any documentation on the subject, or better yet, some examples, it will be a great help.
Thanks a lot.