Thanks for the tip.
I tried to use the WebServiceContext. But it seems that from service
WebServiceContext is injected but MessageContext is not set (it is null).
Here is the code I use.
@WebService
public class MyService implements ServicePortType {
@Resource
private WebServiceContext context;
@WebMethod
public ResponseType send(@WebParam(partName = "Parameters", name =
"RequestElement")
RequestType parameters) throws WSError {
try {
MessageContext ctx = (MessageContext)
context.getMessageContext();
List recv = (List)ctx.get("RECV_RESULTS");
WSHandlerResult wsResult = (WSHandlerResult)recv.get(0);
WSSecurityEngineResult wsseResult =
(WSSecurityEngineResult)wsResult.getResults().get(0);
Principal principal =
(Principal)wsseResult.get(WSSecurityEngineResult.TAG_PRINCIPAL);
principal.getName();
} catch (Exception e) {
e.printStackTrace();
}
ResponseElement response = new ResponseElement();
return response;
}
}
In here a null poiter exception is thrown from line "List recv =
(List)ctx.get("RECV_RESULTS");"
So what I did was use the ThreadLocal to store the usernametoken in
CallbackHandler class and access it from service class. It is ok for the
moment but would be greate if context can be used.
I'm using CXF with mule 2.0.2, so this may be an issue with mule. I posted
it in their forum as well.
Anyway many thanks for lighting my path.
--
View this message in context:
http://www.nabble.com/Access-username-token-from-skelton-tp19873466p19911511.html
Sent from the cxf-user mailing list archive at Nabble.com.