Example #1
0
        protected void Init()
        {
            _logger.Debug(this.GetType().Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "  start...");

            /*
             * webservice referenziati con tecnlogia core .net
             * dotnet core NON gestisce l'autenticazione basic per cui non è utilizzabile con i WS sage V7PU9
             *
             * //Connected Services SageX3WS_old.CAdxWebServiceXmlCCClient _soapClient;
             *
             * // .net core
             * //_soapClient = new SageX3WS_old.CAdxWebServiceXmlCCClient("CAdxWebServiceXmlCC", pSageHost.AbsoluteUri);
             */

            // .net 2.0
            _webService = new X3WS_BasicAuth();
            //_WebService.Url = pSageHost.AbsoluteUri;   // togliendo questa ha funzionato
            _webService.Credentials     = X3WSUtils.GetCredential();
            _webService.PreAuthenticate = true;
            _logger.Debug(this.GetType().Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "  end");
        }
Example #2
0
        public bool Call_X3WS(X3WSUtils.TipoImport tipo, string nomeFile)
        {
            /*
             * Language CODE ITA
             * Pool alias WSSAUROTEST
             * Public Name YIMP_CYBER
             *
             * XML:
             * <PARAM>
             * <FLD NAME="TIPO">OPR</FLD>
             * <FLD NAME="IMPFILE">OPR_task471_191114_042559.TXT</FLD>
             * </PARAM>
             */
            _logger.Debug(this.GetType().Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + " tipo=" + tipo.ToString() + " nomefile=" + nomeFile + "   start...");
            CAdxResultXml XMLresult = new CAdxResultXml();

            List <string[]> KeyValue = new List <string[]>();

            KeyValue.Add(new string[2] {
                "TIPO", ((int)tipo).ToString()
            });
            KeyValue.Add(new string[2] {
                "IMPFILE", nomeFile
            });
            //KeyValue.Add(new string[2] { "TIMESTAMP", timestamp });
            //KeyValue.Add(new string[2] { "MSGERR", "000"});

            /*
             * <PARAM>
             * <FLD NAME="IMPFILE">opr_aaaaa.txt</FLD>
             * <FLD NAME="TIMESTAMP">20000909</FLD>
             * --<FLD NAME="MSGERR">””</FLD>
             * </PARAM>
             */
            string XMLRequest = X3WSUtils.XMLBuildReq("PARAM", "FLD", KeyValue);

            _logger.Debug(this.GetType().Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + " X3webservice pubName:" + X3WSUtils.X3WS_PublicName_ImportSubProgram + "XMlrequest=" + XMLRequest + "   start...");
            XMLresult = RunSubprog(X3WSUtils.X3WS_PublicName_ImportSubProgram, XMLRequest);


            //status

            //1 chiamata eseguita
            int _chk = XMLresult.status;

            if (XMLresult.status == 0)
            {
                //cause possibili sperimentate finora
                //- non esiste chiamata
                //- modello import non esistente
                //- errori nel codice (tipo incompatibile)
                _logger.Error("XMLresult.status=0, controllare log");
            }
            else
            {
                _logger.Info("XMLresult.status=" + XMLresult.status + " [0=errore, 1 ok]");
            }

            //trascrivo sul file di log i messaggi di log (ECR_TRACE from GESECRAN) impostati sul sorgente YIMPOPR
            if (XMLresult.messages != null && XMLresult.messages.Length > 0)
            {
                foreach (var msg in XMLresult.messages)
                {
                    _logger.Info("WS message: " + msg.message);
                }
            }

            string QryResponse = XMLresult.resultXml;

            //Dal flusso di ritorno estrapolo le info che mi servono
            // ...... GetOrdNum_ByRifOrdCli(SoapQryResponse, "FLD", "NRORD");

            string MSGERR = X3WSUtils.GetStringValueFromXML(QryResponse, "FLD", "MSGERR");

            _logger.Debug(this.GetType().Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "  ending");
            if (MSGERR == "Imported")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }