import
javax.xml.ws.WebServiceContext;
public
class
CustomerServiceImpl
implements
CustomerService {
@Resource
WebServiceContext wsContext;
public
List<Customer> getCustomersByName(String name)
throws
NoSuchCustomerException {
Principal pr = wsContext.getUserPrincipal();
if
(pr ==
null
|| !
"joe"
.equals(pr.getName())) {
throw
new
RuntimeException(
"Access denied"
);
}
if
(!wsContext.isUserInRole(
"sales"
)) {
throw
new
RuntimeException(
"Access denied"
);
}
MessageContext mContext = wsContext.getMessageContext();
Set<String> s = mContext.keySet();
WrappedMessageContext wmc = (WrappedMessageContext)mContext;
Message m = wmc.getWrappedMessage();
Exchange ex = m.getExchange();
}
}