Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. My Handler code :
  2.  
  3. public static void addCustomUserNameTokenSOAPHeader(javax.xml.rpc.Stub stub,Configuration config,Binding binding) throws SOAPException{
  4. logger.debug("inside addCustomUserNameTokenSOAPHeader");
  5.  
  6. SOAPHeaderElement security = new SOAPHeaderElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","Security");
  7. security.setActor(null);
  8. security.removeAttributeNS("http://schemas.xmlsoap.org/soap/envelope/", "actor");
  9. security.setPrefix("wss");
  10.  
  11. SOAPHeaderElement binarySecurityToken = new SOAPHeaderElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","wss:UsernameToken");
  12. binarySecurityToken.setActor(null);
  13. SOAPHeaderElement username = new SOAPHeaderElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","wss:Username");
  14. username.setActor(null);
  15. username.setValue(config.getSetting(Configuration.USCC_SECURITY_USERNAME));
  16. SOAPHeaderElement password = new SOAPHeaderElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","wssassword");
  17. password.setActor(null);
  18. password.setValue(config.getSetting(Configuration.USCC_SECURITY_PASSWORD));
  19. binarySecurityToken.addChild(username);
  20. binarySecurityToken.addChild(password);
  21. security.addChild(binarySecurityToken);
  22. stub.setHeader(security); // I need it's substitute
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement