Add header in SOAP request

0

This new thread comes derived from: this other one

Finally I was able to move forward a bit (I think). With the help of Carlos Peix, I managed to get the proxy through a reference to the service.

Now I'm getting the following message: "System.ServiceModel.ProtocolException: A HTTP Content-Type header is needed for SOAP messages, but none was found."

I have tried several ways with examples that I found without being able to solve it.

What would be the correct way to add that header based on the logic that I have armed?

    [TestMethod]
    public void TestWSFalabellaProxyDemo()
    {
        var request = new ServiceFalabella.entregadocumentorequest();

        request.tipodocumento = ServiceFalabella.tipodocumento.F12;
        request.folio = "12534447916";
        request.patente = "BB123BB";
        request.longitud = 0;
        request.codigonoentrega = 4;

        var rut = new ServiceFalabella.rut();
        rut.mantisa = "1";
        rut.dv = "9";
        request.rutreceptor = rut;

        request.parentesco = ServiceFalabella.parentesco.CLIENTE;
        request.autorizacion = ServiceFalabella.autorizacion.CON_AUTORIZACION;

        var address = new EndpointAddress("https://b2b.falabella.com/b2bwsfaarpr/ws/entregaDocumentoService");
        var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);

        var proxy = new ServiceFalabella.EntregaDocumentoServiceClient(binding, address);

        proxy.ClientCredentials.UserName.UserName = "usuario";
        proxy.ClientCredentials.UserName.Password = "contraseña";

        var response = proxy.entregaDocumento(request);
    }
    
asked by cpistiner 30.11.2018 в 13:02
source

0 answers