Example #1
0
        public async override Task <NPCEResult> InviaAsync()
        {
            LetteraSubmit letteraBE = SetLetteraSubmit();

            letteraBE.IdRichiesta = IdRichiesta;
            LetteraResponse letteraResult = null;


            CE.Header.GUIDMessage = IdRichiesta;


            CE.Body = SerializationUtility.SerializeToXmlElement(letteraBE);

            try
            {
                SubmitRequestRequest request = new SubmitRequestRequest(CE);
                var response = await WsCEClient.SubmitRequestAsync(request);

                try
                {
                    letteraResult = SerializationUtility.Deserialize <LetteraResponse>(response.CE.Body);

                    return(letteraResult.CreateResult(response.CE));
                }
                catch (Exception ex)
                {
                    throw (ex);
                }
            }
            finally
            {
                WsCEClient.InnerChannel.Close();
            }
        }
Example #2
0
        public override NPCEResult Invia()
        {
            LetteraSubmit letteraBE = SetLetteraSubmit();

            letteraBE.IdRichiesta = IdRichiesta;
            LetteraResponse letteraResult = null;

            CE.Body = SerializationUtility.SerializeToXmlElement(letteraBE);


            try
            {
                var ce = CE;;
                WsCEClient.SubmitRequest(ref ce);
                try
                {
                    letteraResult = SerializationUtility.Deserialize <LetteraResponse>(ce.Body);

                    return(letteraResult.CreateResult(ce));
                }
                catch (Exception ex)
                {
                    throw (ex);
                }
            }
            finally
            {
                WsCEClient.InnerChannel.Close();
            }
        }
Example #3
0
        public override NpceOperationResult Invio()
        {
            CE ce = GetCE();

            LetteraSubmit letteraBE = SetLetteraBE();

            letteraBE.IdRichiesta = _idRichiesta;
            LetteraResponse letteraResult = null;

            ce.Body = SerializationUtility.SerializeToXmlElement(letteraBE);

            using (WsCEClient client = new WsCEClient())
            {
                client.Endpoint.Address = new System.ServiceModel.EndpointAddress(_ambiente.LolUri);
                client.SubmitRequest(ref ce);
                try
                {
                    letteraResult = SerializationUtility.Deserialize <LetteraResponse>(ce.Body);
                }
                catch (Exception ex)
                {
                    throw (ex);
                }
            }

            return(CreateResult(NpceOperation.Invio, ce.Result.ResType == TResultResType.I ? "0" : "99", ce.Result.Description?.Substring(0, Math.Min(ce.Result.Description.Length, 500)) ?? "Invio Ok", letteraResult.IdRichiesta, null, null));
        }
Example #4
0
 public static NPCEResult CreateResult(this LetteraResponse result, CE ce)
 {
     return(new NPCEResult
     {
         Code = ce.Result.ResType.ToString(),
         Description = ce.Result.Description,
         IdRichiesta = result.IdRichiesta
     });
 }