use of org.springframework.ws.soap.SoapBody in project OpenClinica by OpenClinica.
the class UserPermissionInterceptor method handleRequest.
public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception {
ResourceBundleProvider.updateLocale(new Locale("en_US"));
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
String username = null;
if (principal instanceof UserDetails) {
username = ((UserDetails) principal).getUsername();
} else {
username = principal.toString();
}
UserAccountDAO userAccountDao = new UserAccountDAO(dataSource);
UserAccountBean userAccountBean = ((UserAccountBean) userAccountDao.findByUserName(username));
Boolean result = userAccountBean.getRunWebservices();
if (!result) {
SoapBody response = ((SoapMessage) messageContext.getResponse()).getSoapBody();
response.addClientOrSenderFault("Authorization is required to execute SOAP web services with this account.Please contact your administrator.", Locale.ENGLISH);
return false;
} else {
return result;
}
}
use of org.springframework.ws.soap.SoapBody in project webservices-axiom by apache.
the class TestCreateWebServiceMessage method runTest.
@Override
protected void runTest(SoapMessageFactory messageFactory) {
SoapMessage message = messageFactory.createWebServiceMessage();
SoapEnvelope env = message.getEnvelope();
assertNotNull(env);
assertEquals(spec.getEnvelopeQName(), env.getName());
SoapHeader header = env.getHeader();
assertNotNull(header);
assertEquals(spec.getHeaderQName(), header.getName());
SoapBody body = env.getBody();
assertNotNull(body);
assertEquals(spec.getHeaderQName(), header.getName());
}
Aggregations