Consume SOAP with another REST service (Asp.Net Core 2.0)

0

This is my first post in Stack Español (SoEsp)

This is my interface and classes of my soap service

Interface

[ServiceContract]
public interface IOptOutService
{
   [OperationContract]
   [WebInvoke]
   void PostOptOut(OptOutEntity cliente);
}

e a classe

[CollectionDataContract]
public class OptOutService : IOptOutService
{
    public void PostOptOut(OptOutEntity cliente)
    {
        throw new NotImplementedException();
    }
}

here is my Model

[DataContract]
public class OptOutEntity
{
    [DataMember]
    public Int64 Cpf { get; set; }
    [DataMember]
    public String Email { get; set; }
    [DataMember]
    public String Telefone { get; set; }
    [DataMember]
    public String Bandeira { get; set; }
    [DataMember]
    public String Canal { get; set; }

    public OptOutEntity(Int64 cpf, string email, string telefone, string bandeira, string canal)
    {
       Cpf = cpf;
       Email = email;
       Telefone = telefone;
       Bandeira = bandeira;
       Canal = canal;
     }
}

Well, below this is my controller that is in the REST service

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

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

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

  return cliente;
}

Or what I want is that with this REST I can consume a soap service and fill the client parameter with the data of the REST service that is in the variable client

    
asked by pnet 22.06.2018 в 15:31
source

0 answers