// Set handler chain for each port of this service
while(ports.hasNext()) {
QName nextPort = ports.next();
LinkedList handlerChainList = desc.getHandlerChain();
for(Iterator<WebServiceHandlerChain> i = handlerChainList.iterator(); i.hasNext();) {
WebServiceHandlerChain hc = i.next();
// Apply the serviceName / portName filter to ensure
// that the handlers are for this service and this port
if(!patternsMatch(hc, desc.getServiceName(), nextPort, null)) {
continue;
}
// Decide for what all protocols this handler should be applied
ArrayList<String> protocols = new ArrayList<String>();
if(hc.getProtocolBindings() == null) {
// No protocol bindings given in descriptor; apply this handler
// for all protocols
protocols.add(HTTPBinding.HTTP_BINDING);
protocols.add(SOAPBinding.SOAP11HTTP_BINDING);
protocols.add(SOAPBinding.SOAP12HTTP_BINDING);
protocols.add(SOAPBinding.SOAP11HTTP_MTOM_BINDING);
protocols.add(SOAPBinding.SOAP12HTTP_MTOM_BINDING);
} else {
// protocols specified; handlers are for only these protocols
String specifiedProtocols = hc.getProtocolBindings();
if((specifiedProtocols.indexOf(HTTPBinding.HTTP_BINDING) != -1) ||
(specifiedProtocols.indexOf(WebServiceEndpoint.XML_TOKEN) != -1)) {
protocols.add(HTTPBinding.HTTP_BINDING);
}
if((specifiedProtocols.indexOf(SOAPBinding.SOAP11HTTP_BINDING) != -1) ||
(specifiedProtocols.indexOf(WebServiceEndpoint.SOAP11_TOKEN) != -1)) {
protocols.add(SOAPBinding.SOAP11HTTP_BINDING);
}
if((specifiedProtocols.indexOf(SOAPBinding.SOAP12HTTP_BINDING) != -1) ||
(specifiedProtocols.indexOf(WebServiceEndpoint.SOAP12_TOKEN) != -1)) {
protocols.add(SOAPBinding.SOAP12HTTP_BINDING);
}
if((specifiedProtocols.indexOf(SOAPBinding.SOAP11HTTP_MTOM_BINDING) != -1) ||
(specifiedProtocols.indexOf(WebServiceEndpoint.SOAP11_MTOM_TOKEN) != -1)) {
protocols.add(SOAPBinding.SOAP11HTTP_MTOM_BINDING);
}
if((specifiedProtocols.indexOf(SOAPBinding.SOAP12HTTP_MTOM_BINDING) != -1) ||
(specifiedProtocols.indexOf(WebServiceEndpoint.SOAP12_MTOM_TOKEN) != -1)) {
protocols.add(SOAPBinding.SOAP12HTTP_MTOM_BINDING);
}
}
// Iterate through all handlers that have been configured
List<WebServiceHandler> handlersList = hc.getHandlers();
// From this list, remove those handlers that have port-name that is different
// than the current port
for(WebServiceHandler thisOne : handlersList) {
Collection portNames = thisOne.getPortNames();
if(!portNames.isEmpty() &&