none
Rest web service calling soap web service(asmx), how? RRS feed

  • Question

  • I have this below code

                                                     

    [Route("api/[controller]")]
        public class OptOutClientController : Controller
        {
            HttpClient client = new HttpClient();
            private readonly IOptOutService _service;
            public OptOutClientController(IOptOutService service)
            {
                _service = service;
            }

            [HttpPost]
            public OptOutCliente Unsubscribe([FromBody]OptOutCliente cliente)
            {
                if (cliente == null)
                    throw new OptOutException("Informar os dados do cliente OptOut!");

                var valida = _service.Process(cliente);

                BasicHttpBinding httpBinding = new BasicHttpBinding();
                EndpointAddress wsUrl = new EndpointAddress("http://localhost:64460/OptOutService.svc");

                //ServicoWSClient soapClient = new ServicoWSClient(httpBinding, wsUrl);

                return cliente;
            }

        }

    How can I call a asmx web service? Into my var(parameter) **cliente** i have an object. I need to send this object to **asmx web service**. How can i do this?

    Monday, June 25, 2018 4:37 PM