The recipient did not understand the heading 'Security' Web Service

1

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);
    
asked by afar1793 21.11.2017 в 16:03
source

2 answers

-1

I was presented with the same problem friend, you managed to solve the problem. I removed:

  

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"

and now I get this:

  

The type of Multipart / Related content; start-info="text / xml";   type="application / xop + xml";   boundary="---- = _ Part_3723885_1558606895.1523781212142" of the message   response does not match the content type of the link (text / xml;   charset = utf-8). If you use a custom encoder, make sure that   The IsContentTypeSupported method is implemented correctly. The   The first 1024 bytes of the response were:   '------ = _ Part_3723885_1558606895.1523781212142 Content-Type:   application / xop + xml; charset = utf-8; type="text / xml"

     

    
answered by 15.04.2018 в 10:34
-1

good day, you managed to solve the problem, I ask you because I have the same error and I have not been able to consume the DIAN service, the problem is the header of the webconfig, I have not given how to configure it, and on the Internet the information is very scarce.

    
answered by 15.05.2018 в 15:52