if (properties == null) {
return null;
}
MessageSecurityBindingDescriptor binding = null;
WebServiceEndpoint e = (WebServiceEndpoint)
properties.get("SERVICE_ENDPOINT");
if (e != null) {
binding = e.getMessageSecurityBinding();
} else {
ServiceReferenceDescriptor s = (ServiceReferenceDescriptor)
properties.get("SERVICE_REF");
if (s != null) {
WSDLPort p = (WSDLPort) properties.get("WSDL_MODEL");
QName portName = null;
if (p != null) {
portName = p.getName();
}
if (portName != null) {
ServiceRefPortInfo i = s.getPortInfoByPort(portName);
if (i != null) {
binding = i.getMessageSecurityBinding();
}
}
}
}
if (binding != null) {
String bindingLayer = binding.getAttributeValue
(MessageSecurityBindingDescriptor.AUTH_LAYER);
if (bindingLayer == null || layer.equals(bindingLayer)) {
return binding;
}
}