Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- My Handler code :
- public static void addCustomUserNameTokenSOAPHeader(javax.xml.rpc.Stub stub,Configuration config,Binding binding) throws SOAPException{
- logger.debug("inside addCustomUserNameTokenSOAPHeader");
- SOAPHeaderElement security = new SOAPHeaderElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","Security");
- security.setActor(null);
- security.removeAttributeNS("http://schemas.xmlsoap.org/soap/envelope/", "actor");
- security.setPrefix("wss");
- SOAPHeaderElement binarySecurityToken = new SOAPHeaderElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","wss:UsernameToken");
- binarySecurityToken.setActor(null);
- SOAPHeaderElement username = new SOAPHeaderElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","wss:Username");
- username.setActor(null);
- username.setValue(config.getSetting(Configuration.USCC_SECURITY_USERNAME));
- SOAPHeaderElement password = new SOAPHeaderElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","wssassword");
- password.setActor(null);
- password.setValue(config.getSetting(Configuration.USCC_SECURITY_PASSWORD));
- binarySecurityToken.addChild(username);
- binarySecurityToken.addChild(password);
- security.addChild(binarySecurityToken);
- stub.setHeader(security); // I need it's substitute
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement