PolicyMerger policyMerge = PolicyMerger.getMerger();
for (WSDLBoundOperation operation : tubeConfig.getWSDLPort().getBinding().getBindingOperations()) {
QName operationName = new QName(operation.getBoundPortType().getName().getNamespaceURI(),
operation.getName().getLocalPart());
PolicyMapKey messageKey = PolicyMap.createWsdlMessageScopeKey(
serviceName, portName, operationName);
PolicyMapKey operationKey = PolicyMap.createWsdlOperationScopeKey(serviceName, portName, operationName);
//Review:Not sure if this is need and what is the
//difference between operation and message level key.
//securityPolicyNamespaces
Policy operationPolicy = wsPolicyMap.getOperationEffectivePolicy(operationKey);
if (operationPolicy != null) {
policyList.add(operationPolicy);
} else {
//log fine message
//System.out.println("Operation Level Security policy is null");
}
Policy imPolicy = null;
imPolicy = wsPolicyMap.getInputMessageEffectivePolicy(messageKey);
if (imPolicy != null) {
policyList.add(imPolicy);
}
//input message effective policy to be used. Policy elements at various
//scopes merged.
Policy imEP = policyMerge.merge(policyList);
SecurityPolicyHolder outPH = null;
if (imEP != null) {
outPH = addOutgoingMP(operation, imEP, ph);
}
if (imPolicy != null) {
policyList.remove(imPolicy);
}
//one way
SecurityPolicyHolder inPH = null;
Policy omPolicy = null;
omPolicy = wsPolicyMap.getOutputMessageEffectivePolicy(messageKey);
if (omPolicy != null) {
policyList.add(omPolicy);
}
//ouput message effective policy to be used. Policy elements at various
//scopes merged.
Policy omEP = policyMerge.merge(policyList);
if (omPolicy != null) {
policyList.remove(omPolicy);
}
if (omEP != null) {
inPH = addIncomingMP(operation, omEP, ph);
}
Iterator faults = operation.getOperation().getFaults().iterator();
ArrayList<Policy> faultPL = new ArrayList<Policy>();
if (singleAlternative != null) {
faultPL.add(singleAlternative);
}
if (operationPolicy != null) {
faultPL.add(operationPolicy);
}
while (faults.hasNext()) {
WSDLFault fault = (WSDLFault) faults.next();
PolicyMapKey fKey = null;
fKey = PolicyMap.createWsdlFaultMessageScopeKey(
serviceName, portName, operationName,
new QName(operationName.getNamespaceURI(), fault.getName()));
Policy fPolicy = wsPolicyMap.getFaultMessageEffectivePolicy(fKey);