Username creation using PAPI-WS code
Hi all,
I am testing the code in the online example for PAPI-WS i.e. BPM-PapiWs-JaxWs-Example.... I have my process running and PAPI Web Services started.. I have my username and password as test , test...
I am getting errors in username password authentication... I cannot authenticate my participant... The error that I am getting is on the following line:-
Header header = Headers.create(security);
Can somebody explain me the code in the example:-
private static final String SECURITY_NAMESPACE =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
private static void addUsernameTokenProfile(PapiWebService papiWebServicePort)
throws SOAPException {
SOAPFactory soapFactory = SOAPFactory.newInstance();
QName securityQName = new QName(SECURITY_NAMESPACE, "Security");
SOAPElement security = soapFactory.createElement(securityQName);
QName tokenQName = new QName(SECURITY_NAMESPACE, "UsernameToken");
SOAPElement token = soapFactory.createElement(tokenQName);
QName userQName = new QName(SECURITY_NAMESPACE, "Username");
SOAPElement username = soapFactory.createElement(userQName);
username.addTextNode("test");
QName passwordQName = new QName(SECURITY_NAMESPACE, "Password");
SOAPElement password = soapFactory.createElement(passwordQName);
password.addTextNode("test");
token.addChildElement(username);
token.addChildElement(password);
security.addChildElement(token);
Header header = Headers.create(security);
((WSBindingProvider) papiWebServicePort).setOutboundHeaders(header);
}
I understand that this code adds a Username Token Profile.. But I am not clear how does it do that... Can somebody explain and explain me what is the reason behind the error on the line Header header = Headers.create(security); ?