[jboss-user] [JBossWS] - Accessing USERNAME_PROPERTY from Web Service class

mjhammel do-not-reply at jboss.com
Wed Jan 23 19:17:40 EST 2008


In my client I do this to authenticate with BASIC authentication:

            /* Setup to authenticate with the server. */
  |             bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, subscriberID);
  |             bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, pw);
  | 

I'd like to access the USERNAME_PROPERTY from within my web services class.  With JBOSS 4.0.5GA and Axis 1.1 (I think) I did this:

        final MessageContext msgContext = MessageContext.getCurrentContext();
  |         msgContext.getUsername();
  | 

With JBOSS WS 2.0.2 GA (running under JBOSS 4.2.2GA) I've dropped Axis and so I've tried things like this, but none seem to work:


  |     @Resource
  |     WebServiceContext wsContext;
  | 
  | ...
  | 
  |         MessageContext msgContext = wsContext.getMessageContext();
  |         String username = (String) msgContext.get(BindingProvider.USERNAME_PROPERTY) ;
  | 

What's the correct way to access this message property from the server side?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4122860#4122860

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4122860



More information about the jboss-user mailing list