• 1 reply
  • Latest Post - ‏2012-11-06T16:51:35Z by Barbara_Jensen
1 Post

Pinned topic JAX RPC CALL how set wsse:Username and wsse:Password dynamically

‏2011-11-16T16:22:07Z |
Hi All,

Is there any that we can dynamically set values the wsse:Username and wsse:Password with out using the in JAX RPC or else is there any way to generate the below soap header with out using the which is in ibm-webservicesclient-bnd.xmi file in the JAX RPC call and pass it on to the message in the service call.

We have requirement to get the username and password values from the request and pass those values to the service call. I tried this inside the callbackhandler by getting the request from FacesContext but I have the issue when I have more than one facesportlet on same page in this case FacesContext object get the current instance from current loaded thread on current loaded portlet.

<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="">
<wsse:Password Type="">loadtest</wsse:Password>
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {

String serviceusername;
String servicepassword;

RenderRequest renderRequest = (RenderRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();

PortletPreferences prefs = renderRequest.getPreferences();
serviceusername = prefs.getValue("serviceusername", "");
servicepassword = prefs.getValue("servicepassword", "");
username = serviceusername;
password = servicepassword.toCharArray();

int i = 0;
if(callbacks == null || (i = callbacks.length) == 0){
System.out.println("no callbacks found::"+callbacks);

for(int j = 0; j < i; j++)
Callback callback = callbacks[j];
if(callback instanceof NameCallback){
if(callback instanceof PasswordCallback)

Updated on 2012-11-06T16:51:35Z at 2012-11-06T16:51:35Z by Barbara_Jensen
  • Barbara_Jensen
    3 Posts

    Re: JAX RPC CALL how set wsse:Username and wsse:Password dynamically

    Unfortunately, the only way that you can do this using JAX-RPC WS-Security, is to either replace the callback handler (which sets the username and password for the built-in token generator) or the entire token generator. Obviously the callback handler is the better option.