I am consuming a web service but I get the following error:
The recipient of this message did not understand the 'Security' heading from the namespace ' link ', so the message was not processed.
This error usually indicates that the sender of the message enabled a communication protocol that the recipient can not process. Make sure the client link configuration is consistent with the service link.
So I have the configuration:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="facturaElectronicaPortNameSoap11" closeTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://facturaelectronica.dian.gov.co/habilitacion/B2BIntegrationEngine/FacturaElectronica/facturaElectronica.wsdl"
binding="basicHttpBinding" bindingConfiguration="facturaElectronicaPortNameSoap11"
contract="ServiceFacturacionDian.facturaElectronicaPortName"
name="facturaElectronicaPortNameSoap11" >
<headers xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" >
<wsse:Security soap:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" >
<wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>0ef3-77-4e76-ttr5f03</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">h8548fddfa55e3e2</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">kWkpK8Ckk9eIoqGIA5r//Q==</wsse:Nonce>
<wsse:Created>2014-10-13T14:53:05.089Z</wsse:Created>
</wsse:UsernameToken>
</wsse:Security>
</headers>
</endpoint>
</client>
That's how I'm consuming the service:
facturaElectronicaPortNameClient factura = new facturaElectronicaPortNameClient();
EnvioFacturaElectronica envio = new EnvioFacturaElectronica();
envio.NIT = "905485476";
envio.InvoiceNumber = "990000005";
envio.IssueDate = Convert.ToDateTime("2015-06-26T00:00:00");
envio.Document = System.IO.File.ReadAllBytes("C:\Users\usuario\Desktop\face_f09001605360000000001.xml");
peticion.EnvioFacturaElectronicaPeticion1 = envio;
respuesta.EnvioFacturaElectronicaRespuesta1 = factura.EnvioFacturaElectronica(peticion.EnvioFacturaElectronicaPeticion1);