Consume an asmx service from a rest

1

How do I pass an object I have in a REST to an ASMX ? I have this controller in REST that has the object (client) that I want to send to an ASMX

[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/meuservico.asmx");

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

      return cliente;
  }
}

How do I pass this client to the other side?

    
asked by anonymous 25.06.2018 / 20:05

0 answers