的ejb基本身份验证JAX-RPC Web服务如何获得的请求

我在标题中提到的问题是明确的用户名和密码,任何帮助,将不胜感激......的ejb基本身份验证JAX-RPC Web服务如何获得的请求

顺便说一句,我的服务在Jboss 4.2.2GA上运行,我正在使用MyEclipse7.5 此外,这里我曾尝试过,但没有为我工作;

@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");

[解决] 我已经发现该溶液中,在这里它是;

@Context 

protected HttpServletRequest request;

或者

@Context 

protected WebServiceContext context;

...

request.getUserPrincipal().getName(); 

//OR

context.getUserPrincipal().getName();

//will return the username used to getting logged in

回答:

[解决]我已经找到了解决办法,在这儿;

@Context 

protected HttpServletRequest request;

或者

@Context 

protected WebServiceContext context;

...

request.getUserPrincipal().getName(); 

//OR

context.getUserPrincipal().getName();

//will return the username used to getting logged in

以上是 的ejb基本身份验证JAX-RPC Web服务如何获得的请求 的全部内容, 来源链接: utcz.com/qa/261899.html

回到顶部