7

I have a WSDL for a Web Service (https://facturaelectronica.dian.gov.co/habilitacion/B2BIntegrationEngine/FacturaElectronica/facturaElectronica.wsdl) which specifies that it's SOAP 1.1 and should use WS-Security.

The resulting SOAP Header should be like this sample:

<soapenv:Header>
  <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401wss-wssecurity-secext-1.0.xsd">
    <wsse:UsernameToken>
      <wsse:Username>8ac82326-3016-430f-8d69-9efc4bcefd8f</wsse:Username>
      <wsse:Password>6361b7b5322acb07ced00a35a85a4cc5183da3a42ede0b07f5780 67a18425a55</wsse:Password>
      <wsse:Nonce>FmbZRkx1jh2A+imgjD2fLQ==</wsse:Nonce>
      <wsu:Created>2015-07-31T16:34:33.762Z</wsu:Created>
    </wsse:UsernameToken>
  </wsse:Security>
</soapenv:Header>

Any suggestions on how to do this in C# ? (Tried to use WSE3.0 and WCF but did not work)

Thank You.

Luis

Kapol
  • 6,383
  • 3
  • 21
  • 46
  • 1
    Type this in google "how to consume web service in c#" You will get your answer. – MMK Aug 04 '16 at 15:19
  • May be these could help: http://stackoverflow.com/questions/5412666/does-wcf-support-ws-security-with-soap-1-1 http://stackoverflow.com/questions/14740369/wcf-soap-1-1-and-ws-security-1-0-client-certificate-transport-auth-service-cer – Umair Hafeez Aug 04 '16 at 15:20
  • Try that one http://stackoverflow.com/questions/21861230/how-to-consume-third-party-https-wsdl-web-service-in-c-sharp – MMK Aug 04 '16 at 15:20
  • Thanks for the suggestions but if you take a look at this specific WSDL you will see that it does not need Certificates as the links that you are suggesting. – Luis Londono Aug 04 '16 at 15:37
  • Possible duplicate of [WCF: Adding Nonce to UsernameToken](http://stackoverflow.com/questions/896901/wcf-adding-nonce-to-usernametoken) – rene Aug 05 '16 at 11:30
  • Based on Rick Strahl´s article [WCF WS-Security and WSE Nonce Authentication] (https://weblog.west-wind.com/posts/2012/nov/24/wcf-wssecurity-and-wse-nonce-authentication), we used WCF and a custom UsernameToken to communicate with the Web Service but when we get the response back we get a _System.ServiceModel.Security.MessageSecurityException An error occurred when verifying security for the message_ . Any suggestions on the possible cause? – Luis Londono Aug 09 '16 at 14:59

0 Answers0