Guest User

Untitled

a guest
Apr 13th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. _call.setOperation(_operations[0]);
  2. _call.setUseSOAPAction(true);
  3. _call.setSOAPActionURI("process");
  4. _call.setEncodingStyle(null);
  5. _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
  6. _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
  7. _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
  8. _call.setOperationName(new javax.xml.namespace.QName("", "process"));
  9.  
  10. //Introducir la cabecera de seguridad
  11. try{
  12. SOAPHeaderElement elSec1 =
  13. (SOAPHeaderElement)WSSecurityUtils.createWSSecurityHeader(usuario, password, true);
  14.  
  15. _call.addHeader(elSec1);
  16.  
  17. setRequestHeaders(_call);
  18. setAttachments(_call);
  19.  
  20.  
  21. donde
  22.  
  23. public static SOAPHeaderElement createWSSecurityHeader (String pUsername,
  24. String pCredential,
  25. boolean pIsWSPolicyCompliant)
  26. throws SOAPException
  27. {
  28.  
  29. SOAPHeaderElement elWsSecurity =
  30. new SOAPHeaderElement(SEC_NAMESPACE_OASIS , SECURITY);
  31. // ws policy
  32. elWsSecurity.setMustUnderstand(pIsWSPolicyCompliant);
  33. elWsSecurity.setPrefix(PREFIX);
  34. // this is the username token (wsse:UsernameToken)
  35. SOAPElement seToken = elWsSecurity.addChildElement(USERNAMETOKEN);
  36.  
  37. SOAPElement seTokenUser = seToken.addChildElement(USER);
  38. seTokenUser.addTextNode(pUsername);
  39. if (pCredential != null) {
  40. SOAPElement seTokenPassword = seToken.addChildElement(PASSWORD);
  41. seTokenPassword.addTextNode(pCredential);
  42. }
  43.  
  44. return elWsSecurity;
  45. }
Add Comment
Please, Sign In to add comment