The problem is clear as I mentioned in the title, any help would be appreciated...
By the way, my services are running on Jboss 4.2.2GA and I am using MyEclipse7.5 Moreover, here what I have tried before but did not work for me;
@Stateless
@WebService(name = "BaseService", targetNamespace = "http://base.ws.listingapi.gg.com")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@WebContext(contextRoot = "/listingapi/ws")
public abstract class BaseService {
..
MessageContext mctx = webServiceContext.getMessageContext();
webServiceContext.getUserPrincipal(); //WITH THIS ONE I could get the username but of course not password..
System.out.println(mctx.get("password"));
Map http_headers = (Map) mctx.get(MessageContext.HTTP_REQUEST_HEADERS);
List userList = (List) http_headers.get("Username");
List passList = (List) http_headers.get("Password");
[SOLVED] I have found the solution, here it is;
@Context
protected HttpServletRequest request;
Or
@Context
protected WebServiceContext context;
...
request.getUserPrincipal().getName();
//OR
context.getUserPrin开发者_如何学JAVAcipal().getName();
//will return the username used to getting logged in
[SOLVED] I have found the solution, here it is;
@Context
protected HttpServletRequest request;
Or
@Context
protected WebServiceContext context;
...
request.getUserPrincipal().getName();
//OR
context.getUserPrincipal().getName();
//will return the username used to getting logged in
精彩评论