OperationFinder.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.protocol.engine.mapping;

  21. import org.openspcoop2.core.config.driver.DriverConfigurazioneException;
  22. import org.openspcoop2.core.config.driver.DriverConfigurazioneNotFound;
  23. import org.openspcoop2.core.id.IDServizio;
  24. import org.openspcoop2.core.id.IDSoggetto;
  25. import org.openspcoop2.core.registry.Operation;
  26. import org.openspcoop2.core.registry.PortType;
  27. import org.openspcoop2.core.registry.Resource;
  28. import org.openspcoop2.core.registry.driver.DriverRegistroServiziException;
  29. import org.openspcoop2.core.registry.driver.DriverRegistroServiziNotFound;
  30. import org.openspcoop2.core.registry.wsdl.WSDLValidatorConfig;
  31. import org.openspcoop2.message.MessageUtils;
  32. import org.openspcoop2.message.OpenSPCoop2Message;
  33. import org.openspcoop2.message.constants.MessageType;
  34. import org.openspcoop2.message.constants.ServiceBinding;
  35. import org.openspcoop2.message.rest.RestUtilities;
  36. import org.openspcoop2.message.soap.SoapUtils;
  37. import org.openspcoop2.message.soap.reader.OpenSPCoop2MessageSoapStreamReader;
  38. import org.openspcoop2.protocol.engine.constants.ModalitaIdentificazioneAzione;
  39. import org.openspcoop2.protocol.registry.RegistroServiziManager;
  40. import org.openspcoop2.protocol.sdk.Busta;
  41. import org.openspcoop2.protocol.sdk.IProtocolFactory;
  42. import org.openspcoop2.protocol.sdk.constants.InformationApiSource;
  43. import org.openspcoop2.protocol.sdk.state.RequestInfo;
  44. import org.openspcoop2.protocol.utils.PorteNamingUtils;
  45. import org.openspcoop2.utils.regexp.RegularExpressionEngine;
  46. import org.openspcoop2.utils.rest.api.ApiOperation;
  47. import org.openspcoop2.utils.transport.TransportRequestContext;
  48. import org.openspcoop2.utils.transport.http.HttpRequestMethod;
  49. import org.openspcoop2.utils.xml.AbstractXPathExpressionEngine;
  50. import org.openspcoop2.utils.xml2json.JsonXmlPathExpressionEngine;
  51. import org.slf4j.Logger;
  52. import org.w3c.dom.Element;

  53. /**
  54.  * OperationFinder
  55.  *
  56.  * @author Andrea Poli (apoli@link.it)
  57.  * @author $Author$
  58.  * @version $Rev$, $Date$
  59.  */
  60. public class OperationFinder {
  61.    
  62.     private OperationFinder() {}

  63.     private static String getPrefixIdentificazione(ModalitaIdentificazioneAzione modalitaIdentificazione) {
  64.         return "Identificazione '"+modalitaIdentificazione.getValue()+"' ";
  65.     }
  66.    
  67.     public static String getAzione(RegistroServiziManager registroServiziManager,TransportRequestContext transportContext, RequestInfo requestInfo,
  68.             OpenSPCoop2Message message, OpenSPCoop2MessageSoapStreamReader soapStreamReader,
  69.             IDSoggetto soggettoErogatore, IDServizio idServizio,
  70.             boolean readFirstHeaderIntegrazione, String azioneHeaderIntegrazione,
  71.             IProtocolFactory<?> protocolFactory,
  72.             ModalitaIdentificazioneAzione modalitaIdentificazione, String pattern,
  73.             boolean forceRegistryBased, boolean forcePluginBased,
  74.             Logger log, boolean portaApplicativa,
  75.             boolean bufferMessageReadOnly , String idTransazione,
  76.             WSDLValidatorConfig config) throws DriverConfigurazioneException, IdentificazioneDinamicaException {
  77.        
  78.         try{

  79.             if(soggettoErogatore!=null) {
  80.                  // nop
  81.             }
  82.            
  83.             // Recupero Lista di Azioni
  84.             /**
  85.             List<String> listaAzioni = new ArrayList<>();
  86.             boolean rest = false;
  87.             try {
  88.                 AccordoServizioParteSpecifica asps = registroServiziManager.getAccordoServizioParteSpecifica(idServizio, null, false);
  89.                 AccordoServizioParteComune aspc = registroServiziManager.getAccordoServizioParteComune(IDAccordoFactory.getInstance().getIDAccordoFromUri(asps.getAccordoServizioParteComune()), null, false);
  90.                 if(org.openspcoop2.core.registry.constants.ServiceBinding.REST.equals(aspc.getServiceBinding())) {
  91.                     rest = true;
  92.                     for (Resource r : aspc.getResourceList()) {
  93.                         listaAzioni.add(r.getNome());
  94.                     }
  95.                 }
  96.                 else {
  97.                     if(asps.getPortType()==null) {
  98.                         for (Azione a : aspc.getAzioneList()) {
  99.                             listaAzioni.add(a.getNome());
  100.                         }
  101.                     }
  102.                     else {
  103.                         for (PortType pt: aspc.getPortTypeList()) {
  104.                             if(pt.getNome().equals(asps.getPortType())) {
  105.                                 for (Operation a : pt.getAzioneList()) {
  106.                                     listaAzioni.add(a.getNome());
  107.                                 }
  108.                                 break;
  109.                             }
  110.                         }
  111.                     }
  112.                 }
  113.             }catch(Throwable t) {
  114.                 // ignoro errori, li sollevo in altri posti
  115.             }*/
  116.            
  117.             boolean registryBased = false;
  118.             boolean pluginBased = false;
  119.            
  120.             String azione = null;
  121.             Exception eAzione = null;
  122.             try{
  123.                 if(ModalitaIdentificazioneAzione.STATIC.equals(modalitaIdentificazione)){
  124.                     // STATIC-BASED
  125.                     azione = idServizio.getAzione();
  126.                 }
  127.                 else{
  128.                     if(readFirstHeaderIntegrazione && azioneHeaderIntegrazione!=null){
  129.                         // INTEGRATIONMANAGER INPUT
  130.                         azione = azioneHeaderIntegrazione;
  131.                     }
  132.                     else{
  133.                         if(ModalitaIdentificazioneAzione.URL_BASED.equals(modalitaIdentificazione)){
  134.                             // URL-BASED
  135.                             String urlInvocazionePD = transportContext.getUrlInvocazione_formBased();
  136.                             azione = RegularExpressionEngine.getStringFindPattern(urlInvocazionePD, pattern); // Sostituito Match con Find per applicare l'espressione regolare che risolve il bug OP-1590
  137.                             if(ServiceBinding.REST.equals(message.getServiceBinding())){
  138.                                 throw new DriverConfigurazioneNotFound(getPrefixIdentificazione(modalitaIdentificazione)+
  139.                                         "non supportata per il service binding '"+ServiceBinding.REST+"'");
  140.                             }
  141.                         }                      
  142.                         else if(ModalitaIdentificazioneAzione.HEADER_BASED.equals(modalitaIdentificazione)){
  143.                             // HEADER-BASED
  144.                             azione = transportContext.getHeaderFirstValue(pattern);
  145.                         }
  146.                         else if(ModalitaIdentificazioneAzione.CONTENT_BASED.equals(modalitaIdentificazione)){
  147.                             // CONTENT-BASED
  148.                             if(message==null){
  149.                                 throw new DriverConfigurazioneNotFound("Messaggio non fornito");
  150.                             }
  151.                             AbstractXPathExpressionEngine xPathEngine = null;
  152.                             Element element = null;
  153.                             String elementJson = null;
  154.                             boolean checkSoapBodyEmpty = false; // devo poter fare xpath anche su soapBody empty
  155.                             if(message!=null) {
  156.                                 element = MessageUtils.getContentElement(message, checkSoapBodyEmpty, bufferMessageReadOnly, idTransazione);
  157.                                 elementJson = MessageUtils.getContentString(message, bufferMessageReadOnly, idTransazione);
  158.                             }
  159.                             if(element!=null) {
  160.                                 xPathEngine = new org.openspcoop2.message.xml.XPathExpressionEngine(message.getFactory());
  161.                                 azione = AbstractXPathExpressionEngine.extractAndConvertResultAsString(element, xPathEngine, pattern,  log);
  162.                             }
  163.                             else if(elementJson!=null){
  164.                                 azione = JsonXmlPathExpressionEngine.extractAndConvertResultAsString(elementJson, pattern, log);
  165.                             }
  166.                             else{
  167.                                 throw new DriverConfigurazioneNotFound(getPrefixIdentificazione(modalitaIdentificazione)+"non supportata per il message-type '"+message.getMessageType()+"'");
  168.                             }
  169.                         }
  170.                         else if(ModalitaIdentificazioneAzione.INPUT_BASED.equals(modalitaIdentificazione)){
  171.                             // INPUT-BASED
  172.                             if(azioneHeaderIntegrazione!=null){
  173.                                 azione = azioneHeaderIntegrazione;
  174.                             }
  175.                             else{
  176.                                 throw new DriverConfigurazioneNotFound("Azione non indicata negli header di integrazione");
  177.                             }
  178.                         }
  179.                         else if(ModalitaIdentificazioneAzione.SOAP_ACTION_BASED.equals(modalitaIdentificazione)){
  180.                             // SOAP-ACTION-BASED
  181.                             if(message!=null && ServiceBinding.REST.equals(message.getServiceBinding())){
  182.                                 throw new DriverConfigurazioneNotFound(getPrefixIdentificazione(modalitaIdentificazione)+
  183.                                         "non supportata per il service binding '"+ServiceBinding.REST+"'");
  184.                             }
  185.                             if(message!=null){
  186.                                 azione = message.castAsSoap().getSoapAction();
  187.                             }
  188.                             else{
  189.                                 // provo una soluzione veloce di vedere se è presente nell'header di trasporto o nel content-type
  190.                                 // non so che tipo di message type possiedo
  191.                                 azione = getSoapAction(transportContext);
  192.                             }
  193.                             String azioneNonRipulita = azione;
  194.                             if(azione!=null){
  195.                                 azione = azione.trim();
  196.                                 // Nota: la soap action potrebbe essere quotata con ""
  197.                                 if(azione.startsWith("\"")){
  198.                                     azione = azione.substring(1);
  199.                                 }
  200.                                 if(azione.endsWith("\"")){
  201.                                     azione = azione.substring(0,(azione.length()-1));
  202.                                 }  
  203.                             }
  204.                            
  205.                             // Provo a fare la traduzione tramite soapAction registrata nell'accordo
  206.                             if(azioneNonRipulita!=null || azione!=null) {
  207.                                 org.openspcoop2.core.registry.wsdl.AccordoServizioWrapper wrapper = registroServiziManager.getWsdlAccordoServizio(idServizio,InformationApiSource.SAFE_SPECIFIC_REGISTRY,false,false, requestInfo);
  208.                                 if(wrapper!=null){
  209.                                     for (int i = 0; i < wrapper.sizePortTypeList(); i++) {
  210.                                         PortType pt = wrapper.getPortType(i);
  211.                                         if(wrapper.getNomePortType()!=null &&
  212.                                             !pt.getNome().equals(wrapper.getNomePortType())){
  213.                                             continue;
  214.                                         }
  215.                                         for (int j = 0; j < pt.sizeAzioneList(); j++) {
  216.                                             Operation op = pt.getAzione(j);
  217.                                             if(
  218.                                                 (azioneNonRipulita!=null && azioneNonRipulita.equals(op.getSoapAction()))
  219.                                                 ||
  220.                                                 (azione!=null && azione.equals(op.getSoapAction()))
  221.                                                 ) {
  222.                                                 /**System.out.println("RESOLVE 1 ["+azioneNonRipulita+"]");*/
  223.                                                 /**System.out.println("RESOLVE 2 ["+azione+"]");*/
  224.                                                 azione = op.getNome();
  225.                                                 break;
  226.                                             }
  227.                                         }
  228.                                     }
  229.                                 }
  230.                             }
  231.                            
  232.                             if(azione!=null &&
  233.                                 "".equals(azione)){
  234.                                 azione = null;
  235.                                 throw new DriverConfigurazioneNotFound("SoapAction vuota ("+message.castAsSoap().getSoapAction()+") non è utilizzabile con una identificazione '"+
  236.                                         ModalitaIdentificazioneAzione.SOAP_ACTION_BASED.getValue()+"'");
  237.                             }
  238.                            
  239.                         }
  240.                         else if(ModalitaIdentificazioneAzione.INTERFACE_BASED.equals(modalitaIdentificazione)){
  241.                             // INTERFACE-BASED
  242.                             registryBased = true;
  243.                             OperationFinder.checkIDServizioPerRiconoscimentoAzione(idServizio, modalitaIdentificazione);
  244.                             org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding = registroServiziManager.getServiceBinding(idServizio, requestInfo);
  245.                             if(org.openspcoop2.core.registry.constants.ServiceBinding.SOAP.equals(serviceBinding)){
  246.                                 azione = OperationFinder.searchOperationByWsdlInRequestMessage(message, soapStreamReader, requestInfo, registroServiziManager, idServizio, log,
  247.                                         config);
  248.                             }
  249.                             else {
  250.                                 azione = OperationFinder.searchOperationByRestInRequestMessage(transportContext, requestInfo, registroServiziManager, idServizio, log,
  251.                                         protocolFactory, portaApplicativa);
  252.                             }
  253.                         }
  254.                         else if(ModalitaIdentificazioneAzione.PROTOCOL_BASED.equals(modalitaIdentificazione)){
  255.                             // PROTOCOL-BASED
  256.                             pluginBased = true;
  257.                             if(idServizio.getAzione()!=null){
  258.                                 // gia localizzata in precedenza
  259.                                 azione = idServizio.getAzione();
  260.                             }
  261.                             else{
  262.                                 OpenSPCoop2Message msgAnalizyProtocol = message;
  263.                                 if(message==null && soapStreamReader!=null) {
  264.                                     msgAnalizyProtocol=soapStreamReader.getHeader_OpenSPCoop2Message();
  265.                                 }
  266.                                 if(msgAnalizyProtocol==null){
  267.                                     throw new DriverConfigurazioneNotFound("Messaggio non fornito");
  268.                                 }
  269.                                 Busta busta = protocolFactory.createValidazioneSintattica(null).getBusta_senzaControlli(msgAnalizyProtocol);
  270.                                 if(busta!=null){
  271.                                     azione = busta.getAzione();
  272.                                 }
  273.                             }
  274.                         }
  275.                     }
  276.                 }
  277.             }catch(Exception e){
  278.                 eAzione = e;
  279.             }
  280.            
  281.             // Se non ho riconosciuto una azione, provo con la modalita' wsdlBased se e' abilitata.
  282.             if(azione==null && forceRegistryBased && !registryBased ){
  283.                 azione = getActionByInterface(log,
  284.                         transportContext, idServizio, modalitaIdentificazione,
  285.                         registroServiziManager, requestInfo,
  286.                         message, soapStreamReader,
  287.                         protocolFactory,
  288.                         portaApplicativa,
  289.                         config);
  290.             }
  291.             // Se non ho riconosciuto una azione, provo con la modalita' pluginBased se e' abilitata.
  292.             if(azione==null && forcePluginBased && !pluginBased ){
  293.                 azione = getActionByPlugin(log,
  294.                         idServizio,
  295.                         message, soapStreamReader,
  296.                         protocolFactory);
  297.             }
  298.             // Se non ho riconosciuto una azione a questo punto, e durante il processo standard di riconoscimento era stato sollevata una eccezione
  299.             // viene rilanciato
  300.             if(azione==null && eAzione!=null)
  301.                 throw new IdentificazioneDinamicaException(eAzione.getMessage(),eAzione);

  302.            
  303.             return azione;

  304.         }catch(IdentificazioneDinamicaException e){
  305.             throw e;
  306.         }
  307.         catch(Exception e){
  308.             throw new DriverConfigurazioneException(e.getMessage(),e);
  309.         }

  310.     }
  311.    
  312.     private static String getSoapAction(TransportRequestContext transportContext) {
  313.         String azione = null;
  314.         try{
  315.             azione = SoapUtils.getSoapAction(transportContext, MessageType.SOAP_11, transportContext.getContentType());
  316.         }catch(Exception e){
  317.             // ignore
  318.         }
  319.         if(azione==null){
  320.             try{
  321.                 azione = SoapUtils.getSoapAction(transportContext, MessageType.SOAP_12, transportContext.getContentType());
  322.             }catch(Exception e){
  323.                 // ignore
  324.             }  
  325.         }
  326.         return azione;
  327.     }
  328.    
  329.     private static String getActionByInterface(Logger log,
  330.             TransportRequestContext transportContext, IDServizio idServizio, ModalitaIdentificazioneAzione modalitaIdentificazione,
  331.             RegistroServiziManager registroServiziManager, RequestInfo requestInfo,
  332.             OpenSPCoop2Message message, OpenSPCoop2MessageSoapStreamReader soapStreamReader,
  333.             IProtocolFactory<?> protocolFactory,
  334.             boolean portaApplicativa,
  335.             WSDLValidatorConfig config) {
  336.         String azione = null;
  337.         try{
  338.             OperationFinder.checkIDServizioPerRiconoscimentoAzione(idServizio, modalitaIdentificazione);
  339.             org.openspcoop2.core.registry.constants.ServiceBinding serviceBinding = registroServiziManager.getServiceBinding(idServizio, requestInfo);
  340.             if(org.openspcoop2.core.registry.constants.ServiceBinding.SOAP.equals(serviceBinding)){
  341.                 azione = OperationFinder.searchOperationByWsdlInRequestMessage(message, soapStreamReader, requestInfo, registroServiziManager, idServizio, log,
  342.                         config);
  343.             }
  344.             else{
  345.                 azione = OperationFinder.searchOperationByRestInRequestMessage(transportContext, requestInfo, registroServiziManager, idServizio, log,
  346.                         protocolFactory, portaApplicativa);
  347.             }
  348.         }catch(Exception eForceRegistry){
  349.             log.debug("Riconoscimento forzato dell'azione non riuscito: "+eForceRegistry.getMessage(),eForceRegistry);
  350.         }
  351.         return azione;
  352.     }
  353.    
  354.     public static String searchOperationByWsdlInRequestMessage(OpenSPCoop2Message msg, OpenSPCoop2MessageSoapStreamReader soapStreamReaderParam, RequestInfo requestInfo, RegistroServiziManager registroServiziReader,IDServizio idServizio,Logger log,
  355.             WSDLValidatorConfig config) throws DriverRegistroServiziException, DriverRegistroServiziNotFound{
  356.         return searchOperationByWsdl(true, msg, soapStreamReaderParam, requestInfo, registroServiziReader, idServizio, log,
  357.                 config);
  358.     }
  359.     /**public static String searchOperationByWsdlInResponseMessage(OpenSPCoop2Message msg, RequestInfo requestInfo, RegistroServiziManager registroServiziReader,IDServizio idServizio,Logger log,
  360.         boolean rpcAcceptRootElementUnqualified) throws DriverRegistroServiziException, DriverRegistroServiziNotFound{
  361.         return searchOperationByWsdl(false, msg, requestInfo, registroServiziReader, idServizio, log,
  362.                 rpcAcceptRootElementUnqualified);
  363.     }*/
  364.     private static String searchOperationByWsdl(boolean isRichiesta,OpenSPCoop2Message msg, OpenSPCoop2MessageSoapStreamReader soapStreamReaderParam, RequestInfo requestInfo, RegistroServiziManager registroServiziReader,IDServizio idServizio,Logger log,
  365.             WSDLValidatorConfig config) throws DriverRegistroServiziException, DriverRegistroServiziNotFound{
  366.         org.openspcoop2.core.registry.wsdl.AccordoServizioWrapper wrapper = registroServiziReader.getWsdlAccordoServizio(idServizio,InformationApiSource.SAFE_SPECIFIC_REGISTRY,false,false,requestInfo);
  367.         org.openspcoop2.core.registry.wsdl.AccordoServizioWrapperUtilities wrapperUtilities =
  368.                 new org.openspcoop2.core.registry.wsdl.AccordoServizioWrapperUtilities(log,wrapper);
  369.         return wrapperUtilities.searchOperationName(isRichiesta, wrapper.getNomePortType(), msg, soapStreamReaderParam, config);
  370.     }
  371.    
  372.     public static String searchOperationByRestInRequestMessage(TransportRequestContext transportContext, RequestInfo requestInfo, RegistroServiziManager registroServiziReader,IDServizio idServizio,Logger log,
  373.             IProtocolFactory<?> protocolFactory, boolean portaApplicativa) throws DriverRegistroServiziException, DriverRegistroServiziNotFound{
  374.        
  375.         String normalizedInterfaceName = null;
  376.         try {
  377.             if(transportContext.getInterfaceName()!=null) {
  378.                 PorteNamingUtils namingUtils = new PorteNamingUtils(protocolFactory);
  379.                 if(portaApplicativa){
  380.                     normalizedInterfaceName = namingUtils.normalizePA(transportContext.getInterfaceName());
  381.                 }
  382.                 else {
  383.                     normalizedInterfaceName = namingUtils.normalizePD(transportContext.getInterfaceName());
  384.                 }
  385.             }
  386.         }catch(Exception e) {
  387.             throw new DriverRegistroServiziException(e.getMessage(),e);
  388.         }
  389.         String path = RestUtilities.getUrlWithoutInterface(transportContext, normalizedInterfaceName);
  390.         HttpRequestMethod httpMethod = HttpRequestMethod.valueOf(transportContext.getRequestType());
  391.        
  392.         try {
  393.             org.openspcoop2.core.registry.rest.AccordoServizioWrapper wrapper = registroServiziReader.getRestAccordoServizio(idServizio,InformationApiSource.SAFE_SPECIFIC_REGISTRY,false,false,false, requestInfo);
  394.             ApiOperation op = wrapper.getApi().findOperation(httpMethod, path);
  395.             if(op!=null) {
  396.                 // Il path nella 'ApiOperation è normalizzato come sul registro
  397.                 for (int i = 0; i < wrapper.getAccordoServizio().sizeResourceList(); i++) {
  398.                     Resource r = wrapper.getAccordoServizio().getResource(i);
  399.                    
  400.                     if(r.getMethod()==null) {
  401.                         if(op.getHttpMethod()!=null) {
  402.                             continue;
  403.                         }
  404.                     }
  405.                     else {
  406.                         if(op.getHttpMethod()==null) {
  407.                             continue;
  408.                         }
  409.                         if(!r.getMethod().name().equals(op.getHttpMethod().name())){
  410.                             continue;
  411.                         }
  412.                     }
  413.                    
  414.                     if(r.getPath()==null) {
  415.                         if(op.getPath()!=null) {
  416.                             continue;
  417.                         }
  418.                     }
  419.                     else {
  420.                         String rPath = r.getPath();
  421.                         String opPath = op.getPath();
  422.                         if(rPath!=null && rPath.length()>1 && rPath.endsWith("/")) {
  423.                             rPath = rPath.substring(0,rPath.length()-1);
  424.                         }
  425.                         if(opPath!=null && opPath.length()>1 && opPath.endsWith("/")) {
  426.                             opPath = opPath.substring(0,opPath.length()-1);
  427.                         }
  428.                         if(rPath!=null && !rPath.equals(opPath)){
  429.                             continue;
  430.                         }
  431.                     }
  432.                    
  433.                     return r.getNome();
  434.                    
  435.                 }
  436.             }
  437.         }catch(Exception e) {
  438.             throw new DriverRegistroServiziException(e.getMessage(),e);
  439.         }
  440.        
  441.         return null;
  442.     }
  443.    
  444.     private static String getActionByPlugin(Logger log,
  445.             IDServizio idServizio,
  446.             OpenSPCoop2Message message, OpenSPCoop2MessageSoapStreamReader soapStreamReader,
  447.             IProtocolFactory<?> protocolFactory) {
  448.         String azione = null;
  449.         try{
  450.             if(idServizio.getAzione()!=null){
  451.                 // gia localizzata in precedenza
  452.                 azione = idServizio.getAzione();
  453.             }
  454.             else{
  455.                 OpenSPCoop2Message msgAnalizyProtocol = message;
  456.                 if(message==null && soapStreamReader!=null) {
  457.                     msgAnalizyProtocol=soapStreamReader.getHeader_OpenSPCoop2Message();
  458.                 }
  459.                 if(msgAnalizyProtocol!=null){
  460.                     Busta busta = protocolFactory.createValidazioneSintattica(null).getBusta_senzaControlli(msgAnalizyProtocol);
  461.                     if(busta!=null){
  462.                         azione = busta.getAzione();
  463.                     }
  464.                 }
  465.             }
  466.         }catch(Exception eForcePlugin){
  467.             log.debug("Riconoscimento forzato dell'azione non riuscito: "+eForcePlugin.getMessage(),eForcePlugin);
  468.         }
  469.         return azione;
  470.     }
  471.    
  472.     private static void checkIDServizioPerRiconoscimentoAzione(IDServizio idServizio, ModalitaIdentificazioneAzione modalitaIdentificazione) throws DriverConfigurazioneException{
  473.         String suffixError = " (necessari per procedere con la modalità di identificazione "+modalitaIdentificazione+" dell'azione)";
  474.         if(idServizio==null){
  475.             throw new DriverConfigurazioneException("Dati del servizio non trovati"+suffixError);
  476.         }
  477.         if(idServizio.getSoggettoErogatore()==null){
  478.             throw new DriverConfigurazioneException("Dati del soggetto erogatore del servizio non trovati"+suffixError);
  479.         }
  480.         if(idServizio.getSoggettoErogatore().getTipo()==null){
  481.             throw new DriverConfigurazioneException("Tipo soggetto erogatore del servizio non trovato"+suffixError);
  482.         }
  483.         if(idServizio.getSoggettoErogatore().getNome()==null){
  484.             throw new DriverConfigurazioneException("Nome soggetto erogatore del servizio non trovato"+suffixError);
  485.         }
  486.         if(idServizio.getTipo()==null){
  487.             throw new DriverConfigurazioneException("Tipo servizio non trovato"+suffixError);
  488.         }
  489.         if(idServizio.getNome()==null){
  490.             throw new DriverConfigurazioneException("Nome servizio non trovato"+suffixError);
  491.         }
  492.         if(idServizio.getVersione()==null){
  493.             throw new DriverConfigurazioneException("Versione servizio non trovata"+suffixError);
  494.         }
  495.     }
  496.    
  497. }