WCF does my head in. What I'm trying to do is create a WCF client that will send SOAP messages that contain a username token and are signed with a certificate, but are not encrypted. I've found many articles and blogs with code which almost does what I want, but not quite, and now I'm stumped. Can anyone give me a simple example of how to do this?
What I've done so far is:
- Use svcutil to generate a config file and WCF code from a wsdl and xsd
- Install certificates and load from the certificate store
I've tried many different things and had many different errors and would like a an example which is as simple as possible so I can a) have some chance of understanding it and b) figure out what I need to change to make the code work.
Just a guess, but you could try TransportCredentialOnly. I had trouble last year trying to call a SOAP service with using a WCF client with basic authentication over http and couldn't get it to work. I found a few articles on line but couldn't get any to work.
来源:https://stackoverflow.com/questions/7026743/sending-soap-messages-wcf-client-that-include-a-username-token-and-digital-signa