throw new WebServiceException(ex);
}
try {
//TODO: whether property on BindingProvider.RequestContext is available here
SecurityConfiguration sConfig =
(SecurityConfiguration) packet.invocationProperties.get(MESSAGE_SECURITY_CONFIGURATION);
if (sConfig == null) {
return packet;
}
WSDLBoundOperation op = null;
if (port != null) {
op = packet.getMessage().getOperation(port);
}
QName operationQName = null;
if (op != null) {
operationQName = op.getName();
}
String operation = null;
try {
if (operationQName == null) {
operation = getOperationName(message);
} else {
operation = operationQName.toString();
}
} catch (XWSSecurityException e) {
throw new WebServiceException(e);
}
packet.invocationProperties.put(CONTEXT_WSDL_OPERATION, operation);
StaticApplicationContext sContext =
getPolicyContext(packet, sConfig);
sContext.setOperationIdentifier(operation);
ApplicationSecurityConfiguration config =
sConfig.getSecurityConfiguration();
SecurityPolicy policy = config.getSecurityConfiguration(sContext);
context = new ProcessingContextImpl(packet.invocationProperties);
context.setPolicyContext(sContext);
if (PolicyTypeUtil.declarativeSecurityConfiguration(policy)) {
context.setSecurityPolicy(
((DeclarativeSecurityConfiguration) policy).senderSettings());
} else {
context.setSecurityPolicy(policy);
}
context.setSecurityEnvironment(sConfig.getSecurityEnvironment());
context.isInboundMessage(false);
context.setSOAPMessage(message);
SecurityAnnotator.secureMessage(context);
packet.setMessage(Messages.create(context.getSOAPMessage()));
return packet;