public static void insertHandlers(ServiceRefType serviceRef, URL url) throws Exception {
// Bind the XML handler chain file to an XMLBeans document
XmlObject xml = XmlBeansUtil.parse(url, null);
HandlerChainsDocument hcd = (HandlerChainsDocument) XmlBeansUtil.typedCopy(xml, HandlerChainsDocument.type);
HandlerChainsType handlerChains = hcd.getHandlerChains();
ServiceRefHandlerChainsType serviceRefHandlerChains = serviceRef.addNewHandlerChains();
for (HandlerChainType handlerChain : handlerChains.getHandlerChainArray()) {
ServiceRefHandlerChainType serviceRefHandlerChain = serviceRefHandlerChains.addNewHandlerChain();
if (handlerChain.getPortNamePattern() != null) {
serviceRefHandlerChain.setPortNamePattern(handlerChain.getPortNamePattern());
}
if (handlerChain.getServiceNamePattern() != null) {