ValidatoreMessaggiApplicativi.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.pdd.core;

  21. import java.util.List;

  22. import org.openspcoop2.core.config.Proprieta;
  23. import org.openspcoop2.core.config.ValidazioneContenutiApplicativi;
  24. import org.openspcoop2.core.config.constants.CostantiConfigurazione;
  25. import org.openspcoop2.core.config.constants.StatoFunzionalita;
  26. import org.openspcoop2.core.id.IDServizio;
  27. import org.openspcoop2.core.registry.constants.TipologiaServizio;
  28. import org.openspcoop2.core.registry.driver.DriverRegistroServiziException;
  29. import org.openspcoop2.core.registry.driver.DriverRegistroServiziNotFound;
  30. import org.openspcoop2.core.registry.wsdl.AccordoServizioWrapper;
  31. import org.openspcoop2.core.registry.wsdl.WSDLValidator;
  32. import org.openspcoop2.core.registry.wsdl.WSDLValidatorConfig;
  33. import org.openspcoop2.message.OpenSPCoop2Message;
  34. import org.openspcoop2.message.OpenSPCoop2RestXmlMessage;
  35. import org.openspcoop2.message.OpenSPCoop2SoapMessage;
  36. import org.openspcoop2.message.constants.MessageType;
  37. import org.openspcoop2.message.constants.ServiceBinding;
  38. import org.openspcoop2.pdd.config.CostantiProprieta;
  39. import org.openspcoop2.pdd.config.OpenSPCoop2Properties;
  40. import org.openspcoop2.pdd.logger.OpenSPCoop2Logger;
  41. import org.openspcoop2.protocol.registry.RegistroServiziManager;
  42. import org.openspcoop2.protocol.sdk.constants.CodiceErroreIntegrazione;
  43. import org.openspcoop2.protocol.sdk.constants.ErroriIntegrazione;
  44. import org.openspcoop2.protocol.sdk.constants.InformationApiSource;
  45. import org.openspcoop2.protocol.sdk.constants.IntegrationFunctionError;
  46. import org.openspcoop2.protocol.sdk.state.RequestInfo;
  47. import org.openspcoop2.protocol.utils.ErroriProperties;
  48. import org.slf4j.Logger;


  49. /**
  50.  * Classe utilizzata per validare i messaggi applicativi.
  51.  *
  52.  * @author Poli Andrea (apoli@link.it)
  53.  * @author Lezza Aldo (lezza@openspcoop.org)
  54.  * @author Lorenzo Nardi (nardi@link.it)
  55.  * @author $Author$
  56.  * @version $Rev$, $Date$
  57.  */

  58. public class ValidatoreMessaggiApplicativi {

  59.     /** Registro dei Servizi */
  60.     private RegistroServiziManager registroServiziManager;
  61.     /** Identificativo del Servizio */
  62.     private IDServizio idServizio;
  63.     /** OpenSPCoop2Message */
  64.     private OpenSPCoop2Message message;
  65.     /** WSDL Associato al servizio */
  66.     private AccordoServizioWrapper accordoServizioWrapper = null;
  67.     /** Logger */
  68.     private Logger logger = null;
  69.     /** XMLUtils */
  70.     private org.openspcoop2.message.xml.MessageXMLUtils xmlUtils = null;
  71.     /** WSDLValidator */
  72.     private WSDLValidator wsdlValidator = null;
  73.     /** Nodo rpc root element */
  74.     private boolean rpcAcceptRootElementUnqualified;
  75.     /** Validate SOAPAction */
  76.     private boolean validateSoapAction = true;
  77.     /** Buffer */
  78.     private boolean bufferMessage_readOnly = true;
  79.    
  80.     /** PddContext */
  81.     private PdDContext pddContext;
  82.     /** RequestInfo */
  83.     private RequestInfo requestInfo;
  84.    
  85.    
  86.    
  87.    
  88.     /* ------ Utility ------- */
  89.    
  90.     public static String getTipo(ValidazioneContenutiApplicativi validazioneContenutoApplicativoApplicativo){
  91.         String tipo = validazioneContenutoApplicativoApplicativo.getTipo().getValue();
  92.         if(validazioneContenutoApplicativoApplicativo.getAcceptMtomMessage()!=null){
  93.             if(StatoFunzionalita.ABILITATO.equals(validazioneContenutoApplicativoApplicativo.getAcceptMtomMessage())){
  94.                 tipo = tipo + CostantiConfigurazione.VALIDAZIONE_CONTENUTI_APPLICATIVI_PRINT_SEPARATOR +
  95.                         CostantiConfigurazione.VALIDAZIONE_CONTENUTI_APPLICATIVI_VALIDAZIONE_CON_MTOM;
  96.             }
  97.             if (CostantiConfigurazione.STATO_CON_WARNING_WARNING_ONLY.equals(validazioneContenutoApplicativoApplicativo.getStato())){
  98.                 tipo = tipo + CostantiConfigurazione.VALIDAZIONE_CONTENUTI_APPLICATIVI_PRINT_SEPARATOR +
  99.                         CostantiConfigurazione.VALIDAZIONE_CONTENUTI_APPLICATIVI_VALIDAZIONE_IN_WARNING_MODE;
  100.             }
  101.         }
  102.         return tipo;
  103.     }
  104.    
  105.     public boolean isServizioCorrelato(){
  106.         try{
  107.             return TipologiaServizio.CORRELATO.equals(this.accordoServizioWrapper.getTipologiaServizio());
  108.         }catch(Exception e){
  109.             return false;
  110.         }
  111.     }
  112.    
  113.    
  114.    
  115.    
  116.    
  117.     /* ------ Costruttore -------------- */
  118.     public ValidatoreMessaggiApplicativi(RegistroServiziManager registro,IDServizio idServizio,
  119.             OpenSPCoop2Message message,boolean readWSDLAccordoServizio, boolean gestioneXsiType_rpcLiteral,
  120.             List<Proprieta> proprieta, PdDContext pddContext)throws ValidatoreMessaggiApplicativiException{
  121.        
  122.         if(registro==null){
  123.             ValidatoreMessaggiApplicativiException ex
  124.             = new ValidatoreMessaggiApplicativiException("Reader del Registro dei Servizi non fornito");
  125.             ex.setErrore(ErroriIntegrazione.ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO.get5XX_ErroreProcessamento(CodiceErroreIntegrazione.CODICE_531_VALIDAZIONE_TRAMITE_INTERFACCIA_FALLITA));
  126.             throw ex;
  127.         }
  128.        
  129.         if(idServizio==null || idServizio.getSoggettoErogatore()==null || idServizio.getTipo()==null || idServizio.getNome()==null || idServizio.getVersione()==null ||
  130.                 idServizio.getSoggettoErogatore().getTipo()==null || idServizio.getSoggettoErogatore().getNome()==null){
  131.             ValidatoreMessaggiApplicativiException ex
  132.             = new ValidatoreMessaggiApplicativiException("ID del servizio da validare, non fornito");
  133.             ex.setErrore(ErroriIntegrazione.ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO.get5XX_ErroreProcessamento(CodiceErroreIntegrazione.CODICE_531_VALIDAZIONE_TRAMITE_INTERFACCIA_FALLITA));
  134.             throw ex;
  135.         }
  136.                
  137.         this.message = message;
  138.         boolean hasContent = false;
  139.         try{
  140.             if(ServiceBinding.SOAP.equals(this.message.getServiceBinding())){
  141.                 OpenSPCoop2SoapMessage soapMessage = this.message.castAsSoap();
  142.                 hasContent = !soapMessage.isSOAPBodyEmpty();
  143.                 if(!hasContent) {
  144.                     ValidatoreMessaggiApplicativiException ex
  145.                         = new ValidatoreMessaggiApplicativiException("SOAPBody non esistente");
  146.                     ex.setErrore(ErroriIntegrazione.ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO.get5XX_ErroreProcessamento(CodiceErroreIntegrazione.CODICE_531_VALIDAZIONE_TRAMITE_INTERFACCIA_FALLITA));
  147.                     throw ex;
  148.                 }
  149.             }
  150.             else{
  151.                 if(MessageType.XML.equals(this.message.getMessageType())){
  152.                     OpenSPCoop2RestXmlMessage xml = this.message.castAsRestXml();
  153.                     hasContent = xml.hasContent();
  154.                 }
  155.                 else{
  156.                     throw new Exception("Funzionalità non supportata con ServiceBinding REST e tipologia di messaggio ["+this.message.getMessageType()+"]");
  157.                 }
  158.             }
  159.         }
  160.         catch(ValidatoreMessaggiApplicativiException e){
  161.             throw e;
  162.         }
  163.         catch(Exception e){
  164.             ValidatoreMessaggiApplicativiException ex
  165.                 = new ValidatoreMessaggiApplicativiException(e.getMessage(),e);
  166.             ex.setErrore(ErroriIntegrazione.ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO.get5XX_ErroreProcessamento(CodiceErroreIntegrazione.CODICE_531_VALIDAZIONE_TRAMITE_INTERFACCIA_FALLITA));
  167.             throw ex;
  168.         }
  169.         if(!hasContent){
  170.             ValidatoreMessaggiApplicativiException ex
  171.                 = new ValidatoreMessaggiApplicativiException("Contenuto da validare non esistente");
  172.             ex.setErrore(ErroriIntegrazione.ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO.get5XX_ErroreProcessamento(CodiceErroreIntegrazione.CODICE_531_VALIDAZIONE_TRAMITE_INTERFACCIA_FALLITA));
  173.             throw ex;
  174.         }

  175.         this.registroServiziManager = registro;
  176.         this.idServizio = idServizio;
  177.        
  178.         this.logger = OpenSPCoop2Logger.getLoggerOpenSPCoopCore();
  179.         this.xmlUtils = org.openspcoop2.message.xml.MessageXMLUtils.getInstance(this.message.getFactory());

  180.         this.pddContext = pddContext;
  181.        
  182.         if(this.pddContext!=null && this.pddContext.containsKey(org.openspcoop2.core.constants.Costanti.REQUEST_INFO)) {
  183.             this.requestInfo = (RequestInfo) this.pddContext.getObject(org.openspcoop2.core.constants.Costanti.REQUEST_INFO);
  184.         }
  185.        
  186.         try{
  187.             if(readWSDLAccordoServizio){
  188.                 this.accordoServizioWrapper = this.registroServiziManager.getWsdlAccordoServizio(idServizio,InformationApiSource.SPECIFIC,true,false, this.requestInfo);
  189.             }else{
  190.                 this.accordoServizioWrapper = this.registroServiziManager.getWsdlAccordoServizio(idServizio,InformationApiSource.REGISTRY,true,true, this.requestInfo);
  191.             }
  192.         }catch(DriverRegistroServiziNotFound e){
  193.             this.logger.error("Riscontrato errore durante la ricerca dei wsdl/xsd che definiscono l'accordo di servizio: "+e.getMessage(),e);
  194.             ValidatoreMessaggiApplicativiException ex
  195.             = new ValidatoreMessaggiApplicativiException("Riscontrato errore durante la ricerca del Wsdl: "+e.getMessage(),e);
  196.             ex.setErrore(ErroriIntegrazione.ERRORE_405_SERVIZIO_NON_TROVATO.getErroreIntegrazione());
  197.             throw ex;
  198.         }catch(DriverRegistroServiziException e){
  199.             this.logger.error("Riscontrato errore durante l'inizializzazione: "+e.getMessage(),e);
  200.             ValidatoreMessaggiApplicativiException ex
  201.             = new ValidatoreMessaggiApplicativiException("Riscontrato errore durante l'inizializzazione: "+e.getMessage(),e);
  202.             if(e.getMessage()!=null && e.getMessage().startsWith("[SchemaXSD]")){
  203.                 ex.setErrore(ErroriIntegrazione.ERRORE_417_COSTRUZIONE_VALIDATORE_TRAMITE_INTERFACCIA_FALLITA.getErrore417_CostruzioneValidatoreTramiteInterfacciaFallita(CostantiPdD.SCHEMA_XSD));
  204.                 throw ex;
  205.             }else if(e.getMessage()!=null && e.getMessage().startsWith("[WSDL-FRUITORE]")){
  206.                 ex.setErrore(ErroriIntegrazione.ERRORE_417_COSTRUZIONE_VALIDATORE_TRAMITE_INTERFACCIA_FALLITA.getErrore417_CostruzioneValidatoreTramiteInterfacciaFallita(CostantiPdD.WSDL_FRUITORE));
  207.                 throw ex;
  208.             }else if(e.getMessage()!=null && e.getMessage().startsWith("[WSDL-EROGATORE]")){
  209.                 ex.setErrore(ErroriIntegrazione.ERRORE_417_COSTRUZIONE_VALIDATORE_TRAMITE_INTERFACCIA_FALLITA.getErrore417_CostruzioneValidatoreTramiteInterfacciaFallita(CostantiPdD.WSDL_EROGATORE));
  210.                 throw ex;
  211.             }else{
  212.                 ex.setErrore(ErroriIntegrazione.ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO.get5XX_ErroreProcessamento(CodiceErroreIntegrazione.CODICE_530_COSTRUZIONE_INTERFACCIA_FALLITA));
  213.                 throw ex;
  214.             }
  215.         }
  216.        
  217.         OpenSPCoop2Properties op2Properties = OpenSPCoop2Properties.getInstance();
  218.        
  219.         this.bufferMessage_readOnly = op2Properties.isValidazioneContenutiApplicativiBufferContentRead();
  220.         if(proprieta!=null && !proprieta.isEmpty()) {
  221.             boolean defaultBehaviour = this.bufferMessage_readOnly;
  222.             this.bufferMessage_readOnly = ValidatoreMessaggiApplicativiRest.readBooleanValueWithDefault(proprieta, CostantiProprieta.VALIDAZIONE_CONTENUTI_PROPERTY_NAME_BUFFER_ENABLED, defaultBehaviour);
  223.         }
  224.        
  225.         this.rpcAcceptRootElementUnqualified = op2Properties.isValidazioneContenutiApplicativiRpcAcceptRootElementUnqualified();
  226.         if(proprieta!=null && !proprieta.isEmpty()) {
  227.             boolean default_rpcAcceptRootElementUnqualified = this.rpcAcceptRootElementUnqualified;
  228.             this.rpcAcceptRootElementUnqualified = ValidatoreMessaggiApplicativiRest.readBooleanValueWithDefault(proprieta, CostantiProprieta.VALIDAZIONE_CONTENUTI_PROPERTY_NAME_RPC_ACCEPT_ROOT_ELEMENT_UNQUALIFIED_ENABLED, default_rpcAcceptRootElementUnqualified);
  229.         }
  230.        
  231.         try{
  232.             String idTransazione = null;
  233.             if(this.pddContext!=null) {
  234.                 idTransazione = (String)this.pddContext.getObject(org.openspcoop2.core.constants.Costanti.ID_TRANSAZIONE);
  235.             }
  236.             boolean addPrefixError = false; // utilizzo il prefisso indicato in error.properties
  237.             WSDLValidatorConfig config = new WSDLValidatorConfig();
  238.             config.setGestioneXsiTypeRpcLiteral(gestioneXsiType_rpcLiteral);
  239.             config.setRpcAcceptRootElementUnqualified(this.rpcAcceptRootElementUnqualified);
  240.             config.setValidationXsdAddNamespaceXSITypeIfNotExists(op2Properties.isValidazioneContenutiApplicativiXsdAddNamespaceXSITypeIfNotExists());
  241.             config.setValidationRpcAddNamespaceXSITypeIfNotExists(op2Properties.isValidazioneContenutiApplicativiRpcAddNamespaceXSITypeIfNotExists());
  242.             config.setValidationDocumentAddNamespaceXSITypeIfNotExists(op2Properties.isValidazioneContenutiApplicativiDocumentAddNamespaceXSITypeIfNotExists());        
  243.            
  244.             this.wsdlValidator = new WSDLValidator(this.message, this.xmlUtils, this.accordoServizioWrapper, this.logger,
  245.                     config, addPrefixError,
  246.                     this.bufferMessage_readOnly, idTransazione);
  247.         }catch(Exception e){
  248.             this.logger.error("WSDLValidator initialized failed: "+e.getMessage(),e);
  249.             ValidatoreMessaggiApplicativiException ex
  250.                 = new ValidatoreMessaggiApplicativiException(e.getMessage(),e);
  251.             ex.setErrore(ErroriIntegrazione.ERRORE_5XX_GENERICO_PROCESSAMENTO_MESSAGGIO.get5XX_ErroreProcessamento(CodiceErroreIntegrazione.CODICE_531_VALIDAZIONE_TRAMITE_INTERFACCIA_FALLITA));
  252.             throw ex;
  253.         }
  254.        
  255.         this.validateSoapAction = op2Properties.isValidazioneContenutiApplicativiCheckSoapAction();
  256.         if(proprieta!=null && !proprieta.isEmpty()) {
  257.             boolean defaultSoapAction = this.validateSoapAction;
  258.             this.validateSoapAction = ValidatoreMessaggiApplicativiRest.readBooleanValueWithDefault(proprieta, CostantiProprieta.VALIDAZIONE_CONTENUTI_PROPERTY_NAME_SOAPACTION_ENABLED, defaultSoapAction);
  259.         }
  260.     }
  261.    
  262.    
  263.    
  264.    
  265.    
  266.    
  267.    
  268.     /* ----------- INTERFACCE ---------------- */
  269.     public AccordoServizioWrapper getAccordoServizioWrapper() {
  270.         return this.accordoServizioWrapper;
  271.     }
  272.    
  273.    
  274.    
  275.    
  276.    
  277.    
  278.    
  279.    
  280.    
  281.     /* -------------- VALIDAZIONE XSD --------------------- */
  282.    
  283.     /**
  284.      * Validazione xsd
  285.      *
  286.      * @param isRichiesta Indicazione sul tipo di messaggio applicativo da gestire
  287.      * @throws ValidatoreMessaggiApplicativiException (contiene codice e msg di errore)
  288.      */
  289.     public void validateWithWsdlDefinitorio(boolean isRichiesta) throws ValidatoreMessaggiApplicativiException{
  290.        
  291.         try{
  292.            
  293.             this.wsdlValidator.validateAgainstXSDSchema(isRichiesta, this.idServizio.getAzione());
  294.            
  295.         }catch(org.openspcoop2.utils.wsdl.WSDLException e){
  296.             this.logger.error("WSDL validate failed: "+e.getMessage(),e);
  297.             ValidatoreMessaggiApplicativiException ex
  298.             = new ValidatoreMessaggiApplicativiException(e.getMessage(),e);
  299.             ex.setErrore(ErroriIntegrazione.ERRORE_417_COSTRUZIONE_VALIDATORE_TRAMITE_INTERFACCIA_FALLITA.getErrore417_CostruzioneValidatoreTramiteInterfacciaFallita(CostantiPdD.SCHEMA_XSD));
  300.             throw ex;
  301.         }catch(Exception e){ // WSDLValidatorException
  302.             ValidatoreMessaggiApplicativiException ex
  303.             = new ValidatoreMessaggiApplicativiException(e.getMessage(),e);
  304.            
  305.             String messaggioErrore = e.getMessage();
  306.             boolean overwriteMessageError = false;
  307.             try {
  308.                 messaggioErrore = ErroriProperties.getInstance(this.logger).getGenericDetails_noWrap(isRichiesta ? IntegrationFunctionError.INVALID_REQUEST_CONTENT : IntegrationFunctionError.INVALID_RESPONSE_CONTENT);
  309.                 messaggioErrore = messaggioErrore+": "+e.getMessage();
  310.                 overwriteMessageError = true;
  311.             }catch(Exception excp) {}
  312.            
  313.             if(isRichiesta){
  314.                 ex.setErrore(ErroriIntegrazione.ERRORE_418_VALIDAZIONE_RICHIESTA_TRAMITE_INTERFACCIA_FALLITA.getErrore418_ValidazioneRichiestaTramiteInterfacciaFallita(CostantiPdD.SCHEMA_XSD, messaggioErrore, overwriteMessageError));
  315.             }else{
  316.                 ex.setErrore(ErroriIntegrazione.ERRORE_419_VALIDAZIONE_RISPOSTA_TRAMITE_INTERFACCIA_FALLITA.getErrore419_ValidazioneRispostaTramiteInterfacciaFallita(CostantiPdD.SCHEMA_XSD, messaggioErrore, overwriteMessageError));
  317.             }
  318.             throw ex;
  319.         }
  320.        
  321.     }

  322.    
  323.    
  324.    
  325.    
  326.     /* -------------- VALIDAZIONE WSDL --------------------- */
  327.    
  328.     /**
  329.      * Validazione WSDL
  330.      *
  331.      * @param isRichiesta Indicazione sul tipo di messaggio applicativo da gestire
  332.      *
  333.      */
  334.     public void validateWithWsdlLogicoImplementativo(boolean isRichiesta) throws ValidatoreMessaggiApplicativiException {
  335.        
  336.         try{
  337.             if(ServiceBinding.SOAP.equals(this.message.getServiceBinding())==false){
  338.                 throw new Exception("Tipo di validazione non supportata con Service Binding REST");
  339.             }
  340.            
  341.             this.wsdlValidator.wsdlConformanceCheck(isRichiesta, this.message.castAsSoap().getSoapAction(), this.idServizio.getAzione(),
  342.                     this.validateSoapAction, false);
  343.         }catch(Exception e ){ // WSDLValidatorException
  344.             ValidatoreMessaggiApplicativiException ex
  345.                 = new ValidatoreMessaggiApplicativiException(e.getMessage(),e);
  346.            
  347.             String messaggioErrore = e.getMessage();
  348.             boolean overwriteMessageError = false;
  349.             try {
  350.                 messaggioErrore = ErroriProperties.getInstance(this.logger).getGenericDetails_noWrap(isRichiesta ? IntegrationFunctionError.INVALID_REQUEST_CONTENT : IntegrationFunctionError.INVALID_RESPONSE_CONTENT);
  351.                 if(TipologiaServizio.CORRELATO.equals(this.accordoServizioWrapper.getTipologiaServizio())) {
  352.                     messaggioErrore = messaggioErrore+" 'response service': "+e.getMessage();
  353.                 }
  354.                 else {
  355.                     messaggioErrore = messaggioErrore+": "+e.getMessage();
  356.                 }
  357.                 overwriteMessageError = true;
  358.             }catch(Exception excp) {}
  359.            
  360.             if(isRichiesta){
  361.                 if(TipologiaServizio.CORRELATO.equals(this.accordoServizioWrapper.getTipologiaServizio()))
  362.                     ex.setErrore(ErroriIntegrazione.ERRORE_418_VALIDAZIONE_RICHIESTA_TRAMITE_INTERFACCIA_FALLITA.getErrore418_ValidazioneRichiestaTramiteInterfacciaFallita(CostantiPdD.WSDL_FRUITORE, messaggioErrore, overwriteMessageError));
  363.                 else
  364.                     ex.setErrore(ErroriIntegrazione.ERRORE_418_VALIDAZIONE_RICHIESTA_TRAMITE_INTERFACCIA_FALLITA.getErrore418_ValidazioneRichiestaTramiteInterfacciaFallita(CostantiPdD.WSDL_EROGATORE, messaggioErrore, overwriteMessageError));
  365.             }else{
  366.                 if(TipologiaServizio.CORRELATO.equals(this.accordoServizioWrapper.getTipologiaServizio()))
  367.                     ex.setErrore(ErroriIntegrazione.ERRORE_419_VALIDAZIONE_RISPOSTA_TRAMITE_INTERFACCIA_FALLITA.getErrore419_ValidazioneRispostaTramiteInterfacciaFallita(CostantiPdD.WSDL_FRUITORE, messaggioErrore, overwriteMessageError));
  368.                 else
  369.                     ex.setErrore(ErroriIntegrazione.ERRORE_419_VALIDAZIONE_RISPOSTA_TRAMITE_INTERFACCIA_FALLITA.getErrore419_ValidazioneRispostaTramiteInterfacciaFallita(CostantiPdD.WSDL_EROGATORE, messaggioErrore, overwriteMessageError));
  370.             }
  371.             throw ex;
  372.         }
  373.        
  374.     }
  375.    
  376.     public void restoreOriginalDocument(boolean isRichiesta) throws ValidatoreMessaggiApplicativiException {
  377.        
  378.         try{
  379.             this.wsdlValidator.wsdlConformanceCheck_restoreOriginalDocument();
  380.         }catch(Exception e ){ // WSDLValidatorException
  381.             ValidatoreMessaggiApplicativiException ex
  382.                 = new ValidatoreMessaggiApplicativiException(e.getMessage(),e);
  383.            
  384.             String messaggioErrore = e.getMessage();
  385.             boolean overwriteMessageError = false;
  386.             try {
  387.                 messaggioErrore = ErroriProperties.getInstance(this.logger).getGenericDetails_noWrap(isRichiesta ? IntegrationFunctionError.INVALID_REQUEST_CONTENT : IntegrationFunctionError.INVALID_RESPONSE_CONTENT);
  388.                 if(TipologiaServizio.CORRELATO.equals(this.accordoServizioWrapper.getTipologiaServizio())) {
  389.                     messaggioErrore = messaggioErrore+" 'response service': "+e.getMessage();
  390.                 }
  391.                 else {
  392.                     messaggioErrore = messaggioErrore+": "+e.getMessage();
  393.                 }
  394.                 overwriteMessageError = true;
  395.             }catch(Exception excp) {}
  396.            
  397.             if(isRichiesta){
  398.                 if(TipologiaServizio.CORRELATO.equals(this.accordoServizioWrapper.getTipologiaServizio()))
  399.                     ex.setErrore(ErroriIntegrazione.ERRORE_418_VALIDAZIONE_RICHIESTA_TRAMITE_INTERFACCIA_FALLITA.getErrore418_ValidazioneRichiestaTramiteInterfacciaFallita(CostantiPdD.WSDL_FRUITORE, messaggioErrore, overwriteMessageError));
  400.                 else
  401.                     ex.setErrore(ErroriIntegrazione.ERRORE_418_VALIDAZIONE_RICHIESTA_TRAMITE_INTERFACCIA_FALLITA.getErrore418_ValidazioneRichiestaTramiteInterfacciaFallita(CostantiPdD.WSDL_EROGATORE, messaggioErrore, overwriteMessageError));
  402.             }else{
  403.                 if(TipologiaServizio.CORRELATO.equals(this.accordoServizioWrapper.getTipologiaServizio()))
  404.                     ex.setErrore(ErroriIntegrazione.ERRORE_419_VALIDAZIONE_RISPOSTA_TRAMITE_INTERFACCIA_FALLITA.getErrore419_ValidazioneRispostaTramiteInterfacciaFallita(CostantiPdD.WSDL_FRUITORE, messaggioErrore, overwriteMessageError));
  405.                 else
  406.                     ex.setErrore(ErroriIntegrazione.ERRORE_419_VALIDAZIONE_RISPOSTA_TRAMITE_INTERFACCIA_FALLITA.getErrore419_ValidazioneRispostaTramiteInterfacciaFallita(CostantiPdD.WSDL_EROGATORE, messaggioErrore, overwriteMessageError));
  407.             }
  408.             throw ex;
  409.         }
  410.        
  411.     }
  412.    
  413.    
  414. }