AccordoServizioWrapperUtilities.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */


  20. package org.openspcoop2.core.registry.wsdl;

  21. import java.util.HashMap;
  22. import java.util.List;

  23. import javax.wsdl.BindingInput;
  24. import javax.wsdl.BindingOperation;
  25. import javax.wsdl.BindingOutput;
  26. import javax.wsdl.Definition;
  27. import javax.wsdl.extensions.ExtensibilityElement;
  28. import javax.wsdl.extensions.soap.SOAPBinding;
  29. import javax.wsdl.extensions.soap.SOAPBody;
  30. import javax.wsdl.extensions.soap.SOAPHeader;
  31. import javax.wsdl.extensions.soap.SOAPHeaderFault;
  32. import javax.wsdl.extensions.soap.SOAPOperation;
  33. import javax.xml.namespace.QName;

  34. import org.apache.commons.lang.StringUtils;
  35. import org.openspcoop2.core.registry.AccordoServizioParteComune;
  36. import org.openspcoop2.core.registry.Message;
  37. import org.openspcoop2.core.registry.MessagePart;
  38. import org.openspcoop2.core.registry.Operation;
  39. import org.openspcoop2.core.registry.PortType;
  40. import org.openspcoop2.core.registry.constants.BindingStyle;
  41. import org.openspcoop2.core.registry.constants.BindingUse;
  42. import org.openspcoop2.core.registry.constants.CostantiRegistroServizi;
  43. import org.openspcoop2.core.registry.driver.AccordoServizioUtils;
  44. import org.openspcoop2.core.registry.driver.DriverRegistroServiziException;
  45. import org.openspcoop2.message.OpenSPCoop2Message;
  46. import org.openspcoop2.message.OpenSPCoop2MessageFactory;
  47. import org.openspcoop2.message.constants.ServiceBinding;
  48. import org.openspcoop2.message.soap.reader.OpenSPCoop2MessageSoapStreamReader;
  49. import org.openspcoop2.message.xml.MessageXMLUtils;
  50. import org.openspcoop2.utils.LoggerWrapperFactory;
  51. import org.openspcoop2.utils.resources.FileSystemUtilities;
  52. import org.openspcoop2.utils.transport.http.HttpUtilities;
  53. import org.openspcoop2.utils.wsdl.WSDLUtilities;
  54. import org.openspcoop2.utils.xml.AbstractXMLUtils;
  55. import org.slf4j.Logger;
  56. import org.w3c.dom.Document;


  57. /**
  58.  * Classe utilizzata per leggere/modificare i wsdl che formano un accordo di un servizio
  59.  *
  60.  *
  61.  * @author Poli Andrea (apoli@link.it)
  62.  * @author $Author$
  63.  * @version $Rev$, $Date$
  64.  */


  65. public class AccordoServizioWrapperUtilities {

  66.     private Logger logger = null;
  67.     private RegistroOpenSPCoopUtilities openspcoopUtilities = null;
  68.     private AbstractXMLUtils xmlUtils = null;
  69.     private WSDLUtilities wsdlUtilities = null;
  70.     private AccordoServizioUtils accordoServizioUtils = null;
  71.     private OpenSPCoop2MessageFactory messageFactory;
  72.    
  73.     public AccordoServizioWrapperUtilities(OpenSPCoop2MessageFactory messageFactory, Logger log){
  74.         if(log!=null)
  75.             this.logger = log;
  76.         else
  77.             this.logger = LoggerWrapperFactory.getLogger(AccordoServizioWrapperUtilities.class);
  78.        
  79.         this.messageFactory = messageFactory;
  80.         this.openspcoopUtilities = new RegistroOpenSPCoopUtilities(this.messageFactory, this.logger);
  81.         this.xmlUtils = MessageXMLUtils.getInstance(this.messageFactory);
  82.         this.wsdlUtilities = WSDLUtilities.getInstance(this.xmlUtils);
  83.         this.accordoServizioUtils = new AccordoServizioUtils(this.messageFactory, this.logger);
  84.     }
  85.    
  86.    
  87.     /** Accordo Servizio */
  88.     public AccordoServizioWrapperUtilities(Logger log, AccordoServizioWrapper accordoServizio){
  89.         if(log!=null)
  90.             this.logger = log;
  91.         else
  92.             this.logger = LoggerWrapperFactory.getLogger(AccordoServizioWrapperUtilities.class);
  93.         this.accordoServizioWrapper = accordoServizio;
  94.     }
  95.     private AccordoServizioWrapper accordoServizioWrapper = null;
  96.     public AccordoServizioWrapper getAccordoServizioWrapper() {
  97.         return this.accordoServizioWrapper;
  98.     }
  99.     public void setAccordoServizio(AccordoServizioWrapper accordoServizio) {
  100.         this.accordoServizioWrapper = accordoServizio;
  101.     }
  102.    
  103.    
  104.    
  105.    
  106.    
  107.    
  108.    
  109.     /** Schema */
  110.     public void buildSchema(boolean fromBytes) throws DriverRegistroServiziException {
  111.         if(this.accordoServizioWrapper==null)
  112.             throw new DriverRegistroServiziException("Accordo di Servizio Wrapper non definito, utilizza setAccordoServizioWrapper()");
  113.         if(this.accordoServizioWrapper.getAccordoServizio()==null)
  114.             throw new DriverRegistroServiziException("Accordo di Servizio OpenSPCoop non definito all'interno dell'Accordo di Servizio Wrapper");
  115.         AccordoServizioParteComune as = this.accordoServizioWrapper.getAccordoServizio();
  116.         this.accordoServizioWrapper.setSchema(this.accordoServizioUtils.buildSchema(as, fromBytes));
  117.     }


  118.        
  119.    
  120.    
  121.    
  122.    
  123.    
  124.     /** WSDL */
  125.     public javax.wsdl.Definition buildWsdlErogatore() throws DriverRegistroServiziException{
  126.         if(this.accordoServizioWrapper==null)
  127.             throw new DriverRegistroServiziException("Accordo di Servizio Wrapper non definito, utilizza setAccordoServizioWrapper()");
  128.         if(this.accordoServizioWrapper.getAccordoServizio()==null)
  129.             throw new DriverRegistroServiziException("Accordo di Servizio OpenSPCoop non definito all'interno dell'Accordo di Servizio Wrapper");
  130.         AccordoServizioParteComune as = this.accordoServizioWrapper.getAccordoServizio();
  131.         if(as.getWsdlLogicoErogatore()==null || "".equals(as.getWsdlLogicoErogatore()) ){
  132.             throw new DriverRegistroServiziException("Location del WsdlLogicoErogatore non definito");
  133.         }
  134.         javax.wsdl.Definition wsdl = this.buildWsdl(as.getWsdlLogicoErogatore());
  135.        
  136.         if(this.accordoServizioWrapper.getLocationWsdlImplementativoErogatore()!=null && ("".equals(this.accordoServizioWrapper.getLocationWsdlImplementativoErogatore())==false)){
  137.             javax.wsdl.Definition wsdlImplementativo = this.buildWsdl(this.accordoServizioWrapper.getLocationWsdlImplementativoErogatore());
  138.             this.logger.debug("Add parte implementativa...");
  139.             this.openspcoopUtilities.addParteImplementativa(wsdl, wsdlImplementativo);
  140.         }
  141.        
  142.         return wsdl;
  143.     }
  144.     public javax.wsdl.Definition buildWsdlFruitore() throws DriverRegistroServiziException{
  145.         if(this.accordoServizioWrapper==null)
  146.             throw new DriverRegistroServiziException("Accordo di Servizio non definito, utilizza setAccordoServizio()");
  147.         if(this.accordoServizioWrapper.getAccordoServizio()==null)
  148.             throw new DriverRegistroServiziException("Accordo di Servizio OpenSPCoop non definito all'interno dell'Accordo di Servizio Wrapper");
  149.         AccordoServizioParteComune as = this.accordoServizioWrapper.getAccordoServizio();
  150.         if(as.getWsdlLogicoFruitore()==null || "".equals(as.getWsdlLogicoFruitore()) ){
  151.             throw new DriverRegistroServiziException("Location del WsdlLogicoFruitore non definito, utilizza setLocationWsdlLogicoFruitore(String)");
  152.         }
  153.         javax.wsdl.Definition wsdl = this.buildWsdl(as.getWsdlLogicoFruitore());
  154.        
  155.         if(this.accordoServizioWrapper.getLocationWsdlImplementativoFruitore()!=null && ("".equals(this.accordoServizioWrapper.getLocationWsdlImplementativoFruitore())==false)){
  156.             javax.wsdl.Definition wsdlImplementativo = this.buildWsdl(this.accordoServizioWrapper.getLocationWsdlImplementativoFruitore());
  157.             this.logger.debug("Add parte implementativa...");
  158.             this.openspcoopUtilities.addParteImplementativa(wsdl, wsdlImplementativo);
  159.         }
  160.        
  161.         return wsdl;
  162.     }
  163.     public javax.wsdl.Definition buildWsdlErogatoreFromBytes() throws DriverRegistroServiziException{
  164.         if(this.accordoServizioWrapper==null)
  165.             throw new DriverRegistroServiziException("Accordo di Servizio non definito, utilizza setAccordoServizio()");
  166.         if(this.accordoServizioWrapper.getAccordoServizio()==null)
  167.             throw new DriverRegistroServiziException("Accordo di Servizio OpenSPCoop non definito all'interno dell'Accordo di Servizio Wrapper");
  168.         AccordoServizioParteComune as = this.accordoServizioWrapper.getAccordoServizio();
  169.         Definition wsdl = this.openspcoopUtilities.buildWsdlFromObjects(as, this.accordoServizioWrapper.getBytesWsdlImplementativoErogatore(), true);
  170.         return wsdl;
  171.     }
  172.     public javax.wsdl.Definition buildWsdlFruitoreFromBytes() throws DriverRegistroServiziException{
  173.         if(this.accordoServizioWrapper==null)
  174.             throw new DriverRegistroServiziException("Accordo di Servizio non definito, utilizza setAccordoServizio()");
  175.         if(this.accordoServizioWrapper.getAccordoServizio()==null)
  176.             throw new DriverRegistroServiziException("Accordo di Servizio OpenSPCoop non definito all'interno dell'Accordo di Servizio Wrapper");
  177.         AccordoServizioParteComune as = this.accordoServizioWrapper.getAccordoServizio();
  178.         Definition wsdl = this.openspcoopUtilities.buildWsdlFromObjects(as, this.accordoServizioWrapper.getBytesWsdlImplementativoFruitore(), false);
  179.         return wsdl;
  180.     }
  181.     private javax.wsdl.Definition buildWsdl(String url) throws DriverRegistroServiziException{
  182.         try{
  183.                        
  184.             // Costruttore WSDL
  185.             Document document = null;
  186.             if(url.startsWith("http://") || url.startsWith("file://")){
  187.                 document = this.xmlUtils.newDocument(HttpUtilities.requestHTTPFile(url));
  188.             }else{
  189.                 document = this.xmlUtils.newDocument(FileSystemUtilities.readBytesFromFile(url));
  190.             }
  191.            
  192.             // Elimino schema xsd e import di altri wsdl, non servono per la validazione wsdl di openspcoop
  193.             // TODO: Forse questi due imports servono! Nella costruzione del metodo this.openspcoopUtilities.buildWsdlFromObjects gli schemi vengono inseriti nel wsdl.
  194.             this.wsdlUtilities.removeSchemiIntoTypes(document);
  195.             this.wsdlUtilities.removeImports(document);
  196.            
  197.             javax.wsdl.Definition wsdl = this.wsdlUtilities.readWSDLFromDocument(document);
  198.             return wsdl;
  199.         }catch (Exception e) {
  200.             throw new DriverRegistroServiziException("Riscontrato errore durante la costruzione del wsdl ["+url+"]: "+e.getMessage(),e);
  201.         }
  202.     }
  203.    
  204.    
  205.    
  206.    
  207.    
  208.    
  209.    
  210.    
  211.     /** Utilities oggetti Registro OpenSPCoop */
  212.    
  213.     public static void addMessageInputOperation(javax.wsdl.Operation operationWSDL,Logger logger,Operation operationAS, HashMap<String,QName> mapPartQName){
  214.         // Prendo la definizione del messaggio di input
  215.         if(operationWSDL.getInput()!=null && operationWSDL.getInput().getMessage()!=null &&
  216.                 operationWSDL.getInput().getMessage().getParts()!=null){
  217.             QName nameMesssage = operationWSDL.getInput().getMessage().getQName();
  218.             java.util.Map<?,?> argumentsOperationInput = operationWSDL.getInput().getMessage().getParts();
  219.             if(argumentsOperationInput!=null && argumentsOperationInput.size()>0){
  220.                 Message mInputAS = new Message();
  221.                 java.util.Iterator<?> argumentsIterator = argumentsOperationInput.values().iterator();
  222.                 while (argumentsIterator.hasNext()) {
  223.                     MessagePart partAS = new MessagePart();
  224.                     javax.wsdl.Part argument = (javax.wsdl.Part) argumentsIterator.next();
  225.                     partAS.setName(argument.getName());
  226.                     if(argument.getElementName()!=null){
  227.                         String name = argument.getElementName().getLocalPart();
  228.                         String namespace = argument.getElementName().getNamespaceURI();
  229.                         partAS.setElementName(name);
  230.                         partAS.setElementNamespace(namespace);
  231.                     }
  232.                     if(argument.getTypeName()!=null){
  233.                         String name = argument.getTypeName().getLocalPart();
  234.                         String namespace = argument.getTypeName().getNamespaceURI();
  235.                         partAS.setTypeName(name);
  236.                         partAS.setTypeNamespace(namespace);
  237.                     }
  238.                     if(nameMesssage!=null) {
  239.                         mapPartQName.put(partAS.getName(), nameMesssage);
  240.                     }
  241.                     mInputAS.addPart(partAS);
  242.                     logger.debug("add message input dell'operation["+operationWSDL.getName()+
  243.                             "] con name ["+partAS.getName()+"] element-info({"+partAS.getElementNamespace()+"}"+partAS.getElementName()+
  244.                             ") type-info({"+partAS.getTypeNamespace()+"}"+partAS.getTypeName()+")");
  245.                 }
  246.                 operationAS.setMessageInput(mInputAS);
  247.             }
  248.         }
  249.     }
  250.    
  251.     public static void addMessageOutputOperation(javax.wsdl.Operation operationWSDL,Logger logger,Operation operationAS, HashMap<String,QName> mapPartQName){
  252.         // Prendo la definizione del messaggio di output
  253.         if(operationWSDL.getOutput()!=null && operationWSDL.getOutput().getMessage()!=null &&
  254.                 operationWSDL.getOutput().getMessage().getParts()!=null){
  255.             QName nameMesssage = operationWSDL.getOutput().getMessage().getQName();
  256.             java.util.Map<?,?> argumentsOperationOutput = operationWSDL.getOutput().getMessage().getParts();
  257.             if(argumentsOperationOutput!=null && argumentsOperationOutput.size()>0){
  258.                 Message mOutputAS = new Message();
  259.                 java.util.Iterator<?> argumentsIterator = argumentsOperationOutput.values().iterator();
  260.                 while (argumentsIterator.hasNext()) {
  261.                     MessagePart partAS = new MessagePart();
  262.                     javax.wsdl.Part argument = (javax.wsdl.Part) argumentsIterator.next();
  263.                     partAS.setName(argument.getName());
  264.                     if(argument.getElementName()!=null){
  265.                         String name = argument.getElementName().getLocalPart();
  266.                         String namespace = argument.getElementName().getNamespaceURI();
  267.                         partAS.setElementName(name);
  268.                         partAS.setElementNamespace(namespace);
  269.                     }
  270.                     if(argument.getTypeName()!=null){
  271.                         String name = argument.getTypeName().getLocalPart();
  272.                         String namespace = argument.getTypeName().getNamespaceURI();
  273.                         partAS.setTypeName(name);
  274.                         partAS.setTypeNamespace(namespace);
  275.                     }
  276.                     if(nameMesssage!=null) {
  277.                         mapPartQName.put(partAS.getName(), nameMesssage);
  278.                     }
  279.                     mOutputAS.addPart(partAS);
  280.                     logger.debug("add message output dell'operation["+operationWSDL.getName()+
  281.                             "] con name ["+partAS.getName()+"] element-info({"+partAS.getElementNamespace()+"}"+partAS.getElementName()+
  282.                             ") type-info({"+partAS.getTypeNamespace()+"}"+partAS.getTypeName()+")");
  283.                 }
  284.                 operationAS.setMessageOutput(mOutputAS);
  285.             }
  286.         }
  287.     }
  288.    
  289.     public static void setPortTypeSoapBindingStyle(javax.wsdl.Binding bindingWSDL, Logger logger,PortType ptAS){
  290.         String nomePortType = ptAS.getNome();
  291.         List<?> extendibleElements = bindingWSDL.getExtensibilityElements();
  292.         if(extendibleElements!=null){
  293.             logger.debug("esamino binding extendibles ["+extendibleElements.size()+"] per port type: ["+nomePortType+"]");
  294.             for(int i=0; i<extendibleElements.size(); i++){
  295.                 ExtensibilityElement elem = (ExtensibilityElement) extendibleElements.get(i);
  296.                 logger.debug("esamino binding extendibles di tipo:"+elem.getClass().getName()+" instance of SOAPBinding:"+(elem instanceof SOAPBinding));
  297.                 if(elem instanceof SOAPBinding){
  298.                     SOAPBinding soapBinding = (SOAPBinding) elem;
  299.                     ptAS.setStyle(BindingStyle.toEnumConstant(soapBinding.getStyle()));
  300.                     logger.debug("add style port type ["+nomePortType+"]: "+soapBinding.getStyle());
  301.                 }
  302.                 else if(elem instanceof javax.wsdl.extensions.soap12.SOAP12Binding){
  303.                     javax.wsdl.extensions.soap12.SOAP12Binding soapBinding = (javax.wsdl.extensions.soap12.SOAP12Binding) elem;
  304.                     ptAS.setStyle(BindingStyle.toEnumConstant(soapBinding.getStyle()));
  305.                     logger.debug("add style port type ["+nomePortType+"]: "+soapBinding.getStyle());
  306.                 }
  307.             }
  308.         }
  309.     }
  310.    
  311.     public static void setOperationSoapBindingInformation(BindingOperation bindingOperation,Logger logger,
  312.             Operation operationAS,PortType ptAS){
  313.         String nomeOperation = operationAS.getNome();
  314.         String nomePortType = ptAS.getNome();
  315.         List<?> extendibleElementsOperations = bindingOperation.getExtensibilityElements();
  316.         if(extendibleElementsOperations!=null){
  317.             logger.debug("esamino binding extendibles ["+extendibleElementsOperations.size()+"] per azione["+nomeOperation+"] del port type["+nomePortType+"]");
  318.             for(int j=0; j<extendibleElementsOperations.size(); j++){
  319.                 ExtensibilityElement elem = (ExtensibilityElement) extendibleElementsOperations.get(j);
  320.                 logger.debug("esamino binding extendibles di tipo:"+elem.getClass().getName()+" instance of SOAPOperation:"+(elem instanceof SOAPOperation));
  321.                 if(elem instanceof SOAPOperation){
  322.                     SOAPOperation soapOperation = (SOAPOperation) elem;
  323.                     operationAS.setStyle(BindingStyle.toEnumConstant(soapOperation.getStyle()));
  324.                     logger.debug("add style Operation ["+nomeOperation+"] del Port type ["+ptAS.getNome()+"]: "+soapOperation.getStyle());
  325.                     operationAS.setSoapAction(soapOperation.getSoapActionURI());
  326.                     logger.debug("add SOAPAction Operation ["+nomeOperation+"] del Port type ["+ptAS.getNome()+"]: "+soapOperation.getSoapActionURI());
  327.                 }
  328.                 else if(elem instanceof javax.wsdl.extensions.soap12.SOAP12Operation){
  329.                     javax.wsdl.extensions.soap12.SOAP12Operation soapOperation = (javax.wsdl.extensions.soap12.SOAP12Operation) elem;
  330.                     operationAS.setStyle(BindingStyle.toEnumConstant(soapOperation.getStyle()));
  331.                     logger.debug("add style Operation ["+nomeOperation+"] del Port type ["+ptAS.getNome()+"]: "+soapOperation.getStyle());
  332.                     operationAS.setSoapAction(soapOperation.getSoapActionURI());
  333.                     logger.debug("add SOAPAction Operation ["+nomeOperation+"] del Port type ["+ptAS.getNome()+"]: "+soapOperation.getSoapActionURI());
  334.                 }
  335.             }
  336.         }
  337.     }
  338.    
  339.     public static void setMessageInputSoapBindingInformation(BindingOperation bindingOperation,Logger logger,
  340.             Operation operationAS,PortType ptAS, HashMap<String,QName> mapPartQName,
  341.             String wsdlTargetNamespace){
  342.         String nomeOperation = operationAS.getNome();
  343.         String nomePortType = ptAS.getNome();
  344.         BindingInput bindingInput = bindingOperation.getBindingInput();
  345.         if(bindingInput!=null){
  346.             List<?> extendibleElementsMessageInput = bindingInput.getExtensibilityElements();
  347.             if(extendibleElementsMessageInput!=null){
  348.                 logger.debug("esamino binding extendibles ["+extendibleElementsMessageInput.size()+"] per message-input dell'azione["+nomeOperation+"] del port type["+nomePortType+"]");
  349.                 for(int j=0; j<extendibleElementsMessageInput.size(); j++){
  350.                     ExtensibilityElement elem = (ExtensibilityElement) extendibleElementsMessageInput.get(j);
  351.                     logger.debug("esamino binding extendibles di tipo:"+elem.getClass().getName()+" instance of SOAPBody:"+(elem instanceof SOAPBody));
  352.                     setPartMessageSoapBindingOperationInfo(elem, logger, operationAS, ptAS, true, operationAS.getMessageInput(), mapPartQName, wsdlTargetNamespace);
  353.                 }
  354.             }
  355.         }
  356.     }
  357.    
  358.     public static void setMessageOutputSoapBindingInformation(BindingOperation bindingOperation,Logger logger,
  359.             Operation operationAS,PortType ptAS, HashMap<String,QName> mapPartQName,
  360.             String wsdlTargetNamespace){
  361.         String nomeOperation = operationAS.getNome();
  362.         String nomePortType = ptAS.getNome();
  363.         BindingOutput bindingOutput = bindingOperation.getBindingOutput();
  364.         if(bindingOutput!=null){
  365.             List<?> extendibleElementsMessageOutput = bindingOutput.getExtensibilityElements();
  366.             if(extendibleElementsMessageOutput!=null){
  367.                 logger.debug("esamino binding extendibles ["+extendibleElementsMessageOutput.size()+"] per message-output dell'azione["+nomeOperation+"] del port type["+nomePortType+"]");
  368.                 for(int j=0; j<extendibleElementsMessageOutput.size(); j++){
  369.                     ExtensibilityElement elem = (ExtensibilityElement) extendibleElementsMessageOutput.get(j);
  370.                     logger.debug("esamino binding extendibles di tipo:"+elem.getClass().getName()+" instance of SOAPBody:"+(elem instanceof SOAPBody));
  371.                     setPartMessageSoapBindingOperationInfo(elem, logger, operationAS, ptAS, false, operationAS.getMessageOutput(), mapPartQName, wsdlTargetNamespace);
  372.                 }
  373.             }
  374.         }
  375.     }
  376.    
  377.     public static void setPartMessageSoapBindingOperationInfo(ExtensibilityElement elem,Logger logger,
  378.             Operation operationAS,PortType ptAS, boolean inputMessage, Message message,
  379.             HashMap<String,QName> mapPartQName,
  380.             String wsdlTargetNamespace){
  381.        
  382.         String nomeOperation = operationAS.getNome();
  383.         String tipoMessage = "message-input";
  384.         if(!inputMessage){
  385.             tipoMessage = "message-output";
  386.         }
  387.        
  388.         // *** SOAP11 ***
  389.         if(elem instanceof SOAPBody){
  390.             SOAPBody soapBody = (SOAPBody) elem;
  391.             message.setUse(BindingUse.toEnumConstant(soapBody.getUse()));
  392.             if(soapBody.getNamespaceURI()!=null) {
  393.                 message.setSoapNamespace(soapBody.getNamespaceURI());
  394.             }else {
  395.                 message.setSoapNamespace(wsdlTargetNamespace);
  396.             }
  397.             StringBuilder bf = new StringBuilder();
  398.             List<?> listParts = soapBody.getParts();
  399.             if(listParts!=null){
  400.                 for (Object part : listParts) {
  401.                     if(bf.length()>0){
  402.                         bf.append(",");
  403.                     }
  404.                     bf.append(part);
  405.                 }
  406.             }
  407.             logger.debug("add use "+tipoMessage+" Operation ["+nomeOperation+"] (parts:"+bf.toString()+") del Port type ["+ptAS.getNome()+"]: "+soapBody.getUse());
  408.         }
  409.         else if(elem instanceof SOAPHeader){
  410.             SOAPHeader soapHeader = (SOAPHeader) elem;
  411.             String part = soapHeader.getPart();
  412.             QName messageQName = soapHeader.getMessage();
  413.             if(part!=null){
  414.                 if(message.sizePartList()>0){
  415.                     for (int i = 0; i <message.sizePartList(); i++) {
  416.                         if(part.equals(message.getPart(i).getName())){
  417.                             if(messageQName!=null && mapPartQName!=null && mapPartQName.size()>0) {
  418.                                 // verifico che sia effettivamente un part dello stesso messaggio usato per il body
  419.                                 if(mapPartQName.containsKey(part)) {
  420.                                     // verifico che appartenga allo stesso namespace
  421.                                     QName qname = mapPartQName.get(part);
  422.                                     if(!messageQName.toString().equals(qname.toString())){
  423.                                         continue;
  424.                                     }
  425.                                 }
  426.                                 else {
  427.                                     continue;
  428.                                 }
  429.                             }
  430.                             // Li rimuovo poiche' non vengono gestiti nella validazione XSD/WSDL attuale.
  431.                             // TODO: in futuro aggiungere supporto, classificando il part come header o body
  432.                             message.removePart(i);
  433.                             break;
  434.                         }
  435.                     }
  436.                 }
  437.             }
  438.         }
  439.         else if(elem instanceof SOAPHeaderFault){
  440.             SOAPHeaderFault soapHeaderFault = (SOAPHeaderFault) elem;
  441.             String part = soapHeaderFault.getPart();
  442.             QName messageQName = soapHeaderFault.getMessage();
  443.             if(part!=null){
  444.                 if(message.sizePartList()>0){
  445.                     for (int i = 0; i <message.sizePartList(); i++) {
  446.                         if(part.equals(message.getPart(i).getName())){
  447.                             if(messageQName!=null && mapPartQName!=null && mapPartQName.size()>0) {
  448.                                 // verifico che sia effettivamente un part dello stesso messaggio usato per il body
  449.                                 if(mapPartQName.containsKey(part)) {
  450.                                     // verifico che appartenga allo stesso namespace
  451.                                     QName qname = mapPartQName.get(part);
  452.                                     if(!messageQName.toString().equals(qname.toString())){
  453.                                         continue;
  454.                                     }
  455.                                 }
  456.                                 else {
  457.                                     continue;
  458.                                 }
  459.                             }
  460.                             // Li rimuovo poiche' non vengono gestiti nella validazione XSD/WSDL attuale.
  461.                             // TODO: in futuro aggiungere supporto, classificando il part come header o body
  462.                             message.removePart(i);
  463.                             break;
  464.                         }
  465.                     }
  466.                 }
  467.             }
  468.         }
  469.        
  470.         // *** SOAP12 ***
  471.         else if(elem instanceof javax.wsdl.extensions.soap12.SOAP12Body){
  472.             javax.wsdl.extensions.soap12.SOAP12Body soapBody = (javax.wsdl.extensions.soap12.SOAP12Body) elem;
  473.             message.setUse(BindingUse.toEnumConstant(soapBody.getUse()));
  474.             if(soapBody.getNamespaceURI()!=null) {
  475.                 message.setSoapNamespace(soapBody.getNamespaceURI());
  476.             }else {
  477.                 message.setSoapNamespace(wsdlTargetNamespace);
  478.             }
  479.             StringBuilder bf = new StringBuilder();
  480.             List<?> listParts = soapBody.getParts();
  481.             if(listParts!=null){
  482.                 for (Object part : listParts) {
  483.                     if(bf.length()>0){
  484.                         bf.append(",");
  485.                     }
  486.                     bf.append(part);
  487.                 }
  488.             }
  489.             logger.debug("add use "+tipoMessage+" Operation ["+nomeOperation+"] (parts:"+bf.toString()+") del Port type ["+ptAS.getNome()+"]: "+soapBody.getUse());
  490.         }
  491.         else if(elem instanceof javax.wsdl.extensions.soap12.SOAP12Header){
  492.             javax.wsdl.extensions.soap12.SOAP12Header soapHeader = (javax.wsdl.extensions.soap12.SOAP12Header) elem;
  493.             String part = soapHeader.getPart();
  494.             QName messageQName = soapHeader.getMessage();
  495.             if(part!=null){
  496.                 if(message.sizePartList()>0){
  497.                     for (int i = 0; i <message.sizePartList(); i++) {
  498.                         if(part.equals(message.getPart(i).getName())){
  499.                             if(messageQName!=null && mapPartQName!=null && mapPartQName.size()>0) {
  500.                                 // verifico che sia effettivamente un part dello stesso messaggio usato per il body
  501.                                 if(mapPartQName.containsKey(part)) {
  502.                                     // verifico che appartenga allo stesso namespace
  503.                                     QName qname = mapPartQName.get(part);
  504.                                     if(!messageQName.toString().equals(qname.toString())){
  505.                                         continue;
  506.                                     }
  507.                                 }
  508.                                 else {
  509.                                     continue;
  510.                                 }
  511.                             }
  512.                             // Li rimuovo poiche' non vengono gestiti nella validazione XSD/WSDL attuale.
  513.                             // TODO: in futuro aggiungere supporto, classificando il part come header o body
  514.                             message.removePart(i);
  515.                             break;
  516.                         }
  517.                     }
  518.                 }
  519.             }
  520.         }
  521.         else if(elem instanceof javax.wsdl.extensions.soap12.SOAP12HeaderFault){
  522.             javax.wsdl.extensions.soap12.SOAP12HeaderFault soapHeaderFault = (javax.wsdl.extensions.soap12.SOAP12HeaderFault) elem;
  523.             String part = soapHeaderFault.getPart();
  524.             QName messageQName = soapHeaderFault.getMessage();
  525.             if(part!=null){
  526.                 if(message.sizePartList()>0){
  527.                     for (int i = 0; i <message.sizePartList(); i++) {
  528.                         if(part.equals(message.getPart(i).getName())){
  529.                             if(messageQName!=null && mapPartQName!=null && mapPartQName.size()>0) {
  530.                                 // verifico che sia effettivamente un part dello stesso messaggio usato per il body
  531.                                 if(mapPartQName.containsKey(part)) {
  532.                                     // verifico che appartenga allo stesso namespace
  533.                                     QName qname = mapPartQName.get(part);
  534.                                     if(!messageQName.toString().equals(qname.toString())){
  535.                                         continue;
  536.                                     }
  537.                                 }
  538.                                 else {
  539.                                     continue;
  540.                                 }
  541.                             }
  542.                             // Li rimuovo poiche' non vengono gestiti nella validazione XSD/WSDL attuale.
  543.                             // TODO: in futuro aggiungere supporto, classificando il part come header o body
  544.                             message.removePart(i);
  545.                             break;
  546.                         }
  547.                     }
  548.                 }
  549.             }
  550.         }
  551.     }
  552.    
  553.    
  554.    
  555.    
  556.    
  557.    
  558.     /** Accordo Servizio */

  559.     public void buildAccordoServizioWrapperFromWsdl(javax.wsdl.Definition wsdl,boolean readParteImplementativa) throws DriverRegistroServiziException{
  560.            
  561.         try{
  562.             if(this.accordoServizioWrapper==null){
  563.                 this.accordoServizioWrapper = new AccordoServizioWrapper();
  564.             }
  565.             this.accordoServizioWrapper.setPortTypesLoadedFromWSDL(true);
  566.            
  567.             javax.wsdl.PortType portTypeWSDL = null;
  568.             java.util.Map<?,?> portTypes = wsdl.getPortTypes();
  569.             if(portTypes==null || portTypes.size()<=0){
  570.                 throw new DriverRegistroServiziException("Port types non presenti");
  571.             }
  572.             java.util.Iterator<?> portTypeIterator = portTypes.values().iterator();
  573.             HashMap<String, HashMap<String,QName> > mapOperationTo_mapPartQName_input = new HashMap<String, HashMap<String,QName>>() ;
  574.             HashMap<String, HashMap<String,QName> > mapOperationTo_mapPartQName_output = new HashMap<String, HashMap<String,QName>>();
  575.             while(portTypeIterator.hasNext()) {
  576.                 portTypeWSDL = (javax.wsdl.PortType) portTypeIterator.next();
  577.                
  578.                 // PortType Registro (lo stile viene settato dopo)
  579.                 PortType ptAS = new PortType();
  580.                 ptAS.setNome(portTypeWSDL.getQName().getLocalPart());
  581.                 this.logger.debug("add port type: ["+portTypeWSDL.getQName().getLocalPart()+"]");
  582.                
  583.                 java.util.List<?> operations = portTypeWSDL.getOperations();
  584.                 if(operations==null || operations.size()<=0)
  585.                     throw new DriverRegistroServiziException("operations per il port type ["+ptAS.getNome()+"] non presenti");
  586.                 for (int opIndex = 0; opIndex < operations.size(); opIndex++) {
  587.                     javax.wsdl.Operation operationWSDL = (javax.wsdl.Operation) operations.get(opIndex);
  588.                    
  589.                     // Operation Registro (lo stile, use e soapAction viene settato dopo)
  590.                     Operation operationAS = new Operation();
  591.                     operationAS.setNome(operationWSDL.getName());
  592.                     this.logger.debug("add operation: ["+operationWSDL.getName()+"]");
  593.                    
  594.                     // Prendo la definizione del messaggio di input
  595.                     HashMap<String, QName> mapPartQName_input = new HashMap<String, QName>();
  596.                     mapOperationTo_mapPartQName_input.put(operationAS.getNome(), mapPartQName_input);
  597.                     addMessageInputOperation(operationWSDL, this.logger, operationAS, mapPartQName_input);
  598.                    
  599.                     // Prendo la definizione del messaggio di output
  600.                     HashMap<String, QName> mapPartQName_output = new HashMap<String, QName>();
  601.                     mapOperationTo_mapPartQName_output.put(operationAS.getNome(), mapPartQName_output);
  602.                     addMessageOutputOperation(operationWSDL, this.logger, operationAS, mapPartQName_output);
  603.                    
  604.                     ptAS.addAzione(operationAS);
  605.                 }
  606.                 this.accordoServizioWrapper.addPortType(ptAS);
  607.             }
  608.            
  609.             if(readParteImplementativa){
  610.                 java.util.Map<?,?> bindings = wsdl.getAllBindings();
  611.                 if(bindings==null || bindings.size()<=0){
  612.                     throw new DriverRegistroServiziException("bindings non presenti");
  613.                 }
  614.                 this.logger.debug("bindings presenti ["+bindings.size()+"]");
  615.                 javax.wsdl.Binding bindingWSDL = null;
  616.                 java.util.Iterator<?> bindingsIterator = bindings.values().iterator();
  617.                 while(bindingsIterator.hasNext()) {
  618.                     bindingWSDL = (javax.wsdl.Binding) bindingsIterator.next();
  619.                    
  620.                     // Raccolgo dati portType
  621.                     if(bindingWSDL.getPortType()==null) {
  622.                         throw new DriverRegistroServiziException("Un errore è avvenuto durante l'analisi del binding '"+bindingWSDL.getQName()+"': port type non definito o non esistente");
  623.                     }
  624.                     String nomePortType = bindingWSDL.getPortType().getQName().getLocalPart();
  625.                     PortType ptAS = this.accordoServizioWrapper.removePortType(nomePortType);
  626.                     if(ptAS==null)
  627.                         throw new DriverRegistroServiziException("Port type ["+nomePortType+"] non presente, nella lista dei port type, durante l'analisi della parte di binding");
  628.                    
  629.                     this.logger.debug("esamino binding per port type: ["+nomePortType+"]");
  630.                    
  631.                     // SoapBinding PortType
  632.                     setPortTypeSoapBindingStyle(bindingWSDL, this.logger, ptAS);
  633.                    
  634.                     // Definizione operations
  635.                     List<?> bindingsOperation = bindingWSDL.getBindingOperations();
  636.                     if(bindingsOperation==null || bindingsOperation.size()<=0)
  637.                         throw new DriverRegistroServiziException("Bindings operations per il port type ["+ptAS.getNome()+"] non presenti");
  638.                     for(int i=0; i<bindingsOperation.size();i++){
  639.                         BindingOperation bindingOperation = (BindingOperation) bindingsOperation.get(i);
  640.                        
  641.                         // Raccolgo dati operation
  642.                         String nomeOperation = bindingOperation.getName();
  643.                         Operation operationAS = null;
  644.                         for(int j=0;j<ptAS.sizeAzioneList();j++){
  645.                             if(nomeOperation.equals(ptAS.getAzione(j).getNome())){
  646.                                 operationAS = ptAS.removeAzione(j);
  647.                                 j++;
  648.                             }
  649.                         }
  650.                         if(operationAS==null){
  651.                             throw new DriverRegistroServiziException("Operation ["+nomeOperation+"] del Port type ["+ptAS.getNome()+"] non presente, nella lista delle operation, durante l'analisi della parte di binding");
  652.                         }
  653.                        
  654.                         // SoapBinding Operation
  655.                         setOperationSoapBindingInformation(bindingOperation, this.logger, operationAS, ptAS);
  656.                                            
  657.                         // Raccolgo Message-Input
  658.                         setMessageInputSoapBindingInformation(bindingOperation, this.logger, operationAS, ptAS, mapOperationTo_mapPartQName_input.get(operationAS.getNome()), wsdl.getTargetNamespace());
  659.                        
  660.                         // Raccolgo Message-Output
  661.                         setMessageOutputSoapBindingInformation(bindingOperation, this.logger, operationAS, ptAS, mapOperationTo_mapPartQName_output.get(operationAS.getNome()), wsdl.getTargetNamespace());
  662.                        
  663.                         ptAS.addAzione(operationAS);
  664.                     }      
  665.                     this.accordoServizioWrapper.addPortType(ptAS);
  666.                 }
  667.             }
  668.            
  669.         }catch (Exception e) {
  670.             throw new DriverRegistroServiziException("Riscontrato errore durante la lettura del wsdl: "+e.getMessage(),e);
  671.         }
  672.     }
  673.     public void buildAccordoServizioWrapperFromOpenSPCoopAS(AccordoServizioParteComune as) throws DriverRegistroServiziException{
  674.         if(this.accordoServizioWrapper==null){
  675.             this.accordoServizioWrapper = new AccordoServizioWrapper();
  676.         }
  677.         this.accordoServizioWrapper.setPortTypesLoadedFromWSDL(false);
  678.         for(int i=0; i<as.sizePortTypeList();i++){
  679.             this.accordoServizioWrapper.addPortType(as.getPortType(i));
  680.         }
  681.     }
  682.    
  683.    
  684.    
  685.    
  686.    
  687.    
  688.    
  689.    
  690.    
  691.    
  692.     /** Search action  */
  693.    
  694.     public String searchOperationName(boolean isRichiesta, String portType, OpenSPCoop2Message messageParam, OpenSPCoop2MessageSoapStreamReader soapStreamReaderParam,
  695.             WSDLValidatorConfig config) throws DriverRegistroServiziException{
  696.        
  697.         try{
  698.             if(this.accordoServizioWrapper==null){
  699.                 throw new DriverRegistroServiziException("Accordo Servizio Wrapper non definito");
  700.             }
  701.             if(messageParam==null && soapStreamReaderParam==null){
  702.                 throw new DriverRegistroServiziException("Messaggio non fornito");
  703.             }
  704.        
  705.             if(messageParam!=null && !ServiceBinding.SOAP.equals(messageParam.getServiceBinding())){
  706.                 throw new DriverRegistroServiziException("Tipologia REST non supportata");
  707.             }
  708.                
  709.             OpenSPCoop2MessageSoapStreamReader soapStreamReader = null;
  710.             if(soapStreamReaderParam!=null) {
  711.                 soapStreamReader = soapStreamReaderParam;
  712.             }
  713.             else {
  714.                 soapStreamReader = messageParam.castAsSoap().getSoapReader();
  715.             }
  716.             if(soapStreamReader!=null && !soapStreamReader.isParsingComplete()) {
  717.                 soapStreamReader = null;
  718.             }
  719.             //Element rootElement = null;
  720.             String rootElementLocalName = null;
  721.             String rootElementNamespace = null;
  722.             if(soapStreamReader!=null) {
  723.                 //rootElement = soapStreamReader.getRootElement();
  724.                 rootElementLocalName = soapStreamReader.getRootElementLocalName();
  725.                 rootElementNamespace = soapStreamReader.getRootElementNamespace();
  726.             }
  727.            
  728.            
  729.             // Se disponibile il rootElement viene utilizzato per comprendere l'operazione
  730.             // Altrimenti utilizzero' il validatore wsdl
  731.             if(rootElementLocalName!=null) {
  732.                 for (int i = 0; i < this.accordoServizioWrapper.sizePortTypeList(); i++) {
  733.                     PortType pt = this.accordoServizioWrapper.getPortType(i);
  734.                     if(portType!=null){
  735.                         if(pt.getNome().equals(portType)==false){
  736.                             continue;
  737.                         }
  738.                     }
  739.                    
  740.                     BindingStyle style = CostantiRegistroServizi.WSDL_STYLE_DOCUMENT;
  741.                     BindingUse use = CostantiRegistroServizi.WSDL_USE_LITERAL;
  742.                     if(pt.getStyle()!=null && ("".equals(pt.getStyle().getValue())==false) &&
  743.                             CostantiRegistroServizi.WSDL_STYLE_RPC.equals(pt.getStyle()))
  744.                         style = CostantiRegistroServizi.WSDL_STYLE_RPC;
  745.                                            
  746.                     for (int j = 0; j < pt.sizeAzioneList(); j++) {
  747.                         Operation op = pt.getAzione(j);
  748.                         try{
  749.                             // Analizzo stile e uso nell'operazione
  750.                             Message argumentsOperation = isRichiesta ? op.getMessageInput() : op.getMessageOutput();
  751.                             if(op.getStyle()!=null && ("".equals(op.getStyle().getValue())==false)){
  752.                                 if(CostantiRegistroServizi.WSDL_STYLE_RPC.equals(op.getStyle()))
  753.                                     style = CostantiRegistroServizi.WSDL_STYLE_RPC;
  754.                                 else if(CostantiRegistroServizi.WSDL_STYLE_DOCUMENT.equals(op.getStyle()))
  755.                                     style = CostantiRegistroServizi.WSDL_STYLE_DOCUMENT;
  756.                             }
  757.                             if(argumentsOperation!=null && argumentsOperation.getUse()!=null &&
  758.                                     ("".equals(argumentsOperation.getUse().getValue())==false) &&
  759.                                     CostantiRegistroServizi.WSDL_USE_ENCODED.equals(argumentsOperation.getUse())) {
  760.                                 use = CostantiRegistroServizi.WSDL_USE_ENCODED;
  761.                             }
  762.                            
  763.                             // Se Document/Literal provo a verificare rootElementName solo se sono in WrappedDocumentLiteral (1 child)
  764.                             if(CostantiRegistroServizi.WSDL_STYLE_DOCUMENT.equals(style) &&
  765.                                     CostantiRegistroServizi.WSDL_USE_LITERAL.equals(use) &&
  766.                                     argumentsOperation!=null &&
  767.                                     argumentsOperation.sizePartList()==1){
  768.                                 MessagePart part = argumentsOperation.getPart(0);
  769.                                 if(part!=null) {
  770.                                     if(part.getElementName()!=null) {
  771.                                        
  772. //                                              System.out.println("WRAPPED DOCUMENT LITERAL");
  773. //                                              
  774. //                                              System.out.println("ROOT ELEMENT NAME:"+rootElementLocalName);
  775. //                                              System.out.println("ROOT ELEMENT NAMESPACE:"+rootElementNamespace);
  776. //                                              
  777. //                                              System.out.println("SOAP NAMESPACE: "+argumentsOperation.getSoapNamespace());
  778. //                                              System.out.println("ELEMENT NAME: "+part.getElementName());
  779. //                                              System.out.println("ELEMENT NAMESPACE: "+part.getElementNamespace());
  780. //                                              System.out.println("TYPE NAME: "+part.getTypeName());
  781. //                                              System.out.println("TYPE NAMESPACE: "+part.getTypeNamespace());
  782. //                                              System.out.println("NAME: "+part.getName());
  783.                                        
  784.                                         boolean match = part.getElementName().equals(rootElementLocalName);
  785.                                         if(match) {
  786.                                             if(part.getElementNamespace()==null) {
  787.                                                 if(rootElementNamespace!=null) {
  788.                                                     match=false;
  789.                                                 }
  790.                                             }
  791.                                             else {
  792.                                                 if(!part.getElementNamespace().equals(rootElementNamespace)) {
  793.                                                     match=false;
  794.                                                 }
  795.                                             }
  796.                                         }
  797.                                         if(match) {
  798.                                             //System.out.println("FIND OP!!! ["+op.getNome()+"]");
  799.                                             return op.getNome();
  800.                                         }
  801.                                     }
  802.                                 }
  803.                             }
  804.                             else if(CostantiRegistroServizi.WSDL_STYLE_RPC.equals(style)
  805.                                     // va bene anche per encoded
  806.                                     // && CostantiRegistroServizi.WSDL_USE_LITERAL.equals(use)
  807.                                     && rootElementLocalName.equals(op.getNome()) // deve essere uguale su RPC
  808.                                     ){
  809.                                
  810.                                 //System.out.println("RPC '"+use+"'");
  811.                                        
  812.                                 //System.out.println("ROOT ELEMENT NAME:"+rootElementLocalName);
  813.                                 //System.out.println("ROOT ELEMENT NAMESPACE:"+rootElementNamespace);
  814.                                        
  815.                                 //System.out.println("SOAP NAMESPACE: "+argumentsOperation.getSoapNamespace());
  816.                                        
  817.                                 boolean match = true;
  818.                                 if(argumentsOperation!=null && argumentsOperation.getSoapNamespace()==null) {
  819.                                     if(rootElementNamespace!=null) {
  820.                                         match=false;
  821.                                     }
  822.                                 }
  823.                                 else {
  824.                                     if(argumentsOperation!=null && (!argumentsOperation.getSoapNamespace().equals(rootElementNamespace))) {
  825.                                         if(rootElementNamespace==null || StringUtils.isEmpty(rootElementNamespace)) {
  826.                                             if(config!=null && !config.isRpcAcceptRootElementUnqualified()) {
  827.                                                 match=false;
  828.                                             }
  829.                                         }
  830.                                         else {
  831.                                             match=false;
  832.                                         }
  833.                                     }
  834.                                 }
  835.                                 if(match) {
  836.                                     //System.out.println("FIND OP!!! ["+op.getNome()+"]");
  837.                                     return op.getNome();
  838.                                 }
  839.                             }
  840.                         }catch(Exception e){
  841.                             this.logger.debug("@@@searchOperationName Azione ["+op.getNome()+"] mismatch rootElement["+rootElementLocalName+"] namespace["+rootElementNamespace+"]: "+e.getMessage());
  842.                             //e.printStackTrace(SyOstem.out);
  843.                         }
  844.                     }
  845.                 }
  846.             }
  847.            
  848.             // Altrimenti utilizzero' il validatore wsdl
  849.             if(messageParam!=null) {
  850.                 boolean addPrefixError = true;
  851.                 WSDLValidator wsdlValidator = new WSDLValidator(messageParam, this.xmlUtils, this.accordoServizioWrapper, this.logger,
  852.                         config, addPrefixError,
  853.                         false, null);
  854.                 for (int i = 0; i < this.accordoServizioWrapper.sizePortTypeList(); i++) {
  855.                     PortType pt = this.accordoServizioWrapper.getPortType(i);
  856.                     if(portType!=null){
  857.                         if(pt.getNome().equals(portType)==false){
  858.                             continue;
  859.                         }
  860.                     }
  861.                     for (int j = 0; j < pt.sizeAzioneList(); j++) {
  862.                         Operation op = pt.getAzione(j);
  863.                         try{
  864.                             //System.out.println("Check azione ["+op.getNome()+"]...");
  865.                             wsdlValidator.wsdlConformanceCheck(isRichiesta, null, op.getNome(), false, true);
  866.                             return op.getNome();
  867.                         }catch(Exception e){
  868.                             this.logger.debug("@@@searchOperationName Azione ["+op.getNome()+"] mismatch: "+e.getMessage());
  869.                             //e.printStackTrace(System.out);
  870.                         }
  871.                     }
  872.                    
  873.                 }
  874.             }
  875.            
  876.             return null;
  877.         }
  878.         catch(DriverRegistroServiziException e){
  879.             throw e;
  880.         }
  881.         catch(Exception e){
  882.             throw new DriverRegistroServiziException(e.getMessage(),e);
  883.         }
  884.        
  885.     }
  886. }