예제 #1
0
        private async Task <com.epicomfl.PostsSoapClient> getClient()
        {
            var epicomPostUrl = await readContext.Codes
                                .Where(code => code.CdType.Equals("FDENS") && code.CdValue.Equals("POST WEB SERVICE"))
                                .Select(code => code.DsDesc)
                                .FirstOrDefaultAsync();

            Uri epicomPostUri = new Uri(epicomPostUrl);

            com.epicomfl.PostsSoapClient client = new com.epicomfl.PostsSoapClient(com.epicomfl.PostsSoapClient.EndpointConfiguration.PostsSoap, epicomPostUrl, (epicomPostUri.Scheme.ToLower() == "https"));
            client.ClientCredentials.Windows.ClientCredential.Domain   = config["EPICOM_DOMAIN"];
            client.ClientCredentials.Windows.ClientCredential.UserName = config["EPICOM_UID"];
            client.ClientCredentials.Windows.ClientCredential.Password = config["EPICOM_PWD"];

            return(client);
        }
예제 #2
0
        public async Task <IActionResult> SubmitEpicomPost([FromBody] SubmitEpicomPost command)
        {
            command.EpiComUserId = User.FindFirst(MerlinClaim.EpiComUserId).Value;
            command.IdSubmitted  = User.Identity.Name;

            await rules
            .EpiComUserIdMustBeInt()
            .Apply(command, ModelState);

            var epicomPostUrl = await readContext.Codes
                                .Where(code => code.CdType.Equals("FDENS") && code.CdValue.Equals("POST WEB SERVICE"))
                                .Select(code => code.DsDesc)
                                .FirstOrDefaultAsync();

            Uri epicomPostUri = new Uri(epicomPostUrl);

            com.epicomfl.PostsSoapClient c = new com.epicomfl.PostsSoapClient(com.epicomfl.PostsSoapClient.EndpointConfiguration.PostsSoap, epicomPostUrl, (epicomPostUri.Scheme.ToLower() == "https"));
            c.ClientCredentials.Windows.ClientCredential.Domain   = config["EPICOM_DOMAIN"];
            c.ClientCredentials.Windows.ClientCredential.UserName = config["EPICOM_UID"];
            c.ClientCredentials.Windows.ClientCredential.Password = config["EPICOM_PWD"];

            command.PendingPostId = await c.CreatePendingMessageAsync(
                command.TopicId,
                command.Title,
                command.Message,
                int.Parse(command.EpiComUserId));

            await service.Execute(command);

            var uri = Url.Action("Get", new { id = command.PendingPostId });

            //TODO:  Why does this return an empty object?
            //var post = await epicomRepository.GetEpicomPostDetails(command.PendingPostId.Value);

            return(Created(uri, command));
        }