Renjith Kumaran

Renjith Kumaran

  • 1.8k
  • 6
  • 1.2k

Soap Message Signing

Aug 2 2017 3:14 AM
Hi All

Good Day!

I am working on sending one soap request to a server. I have added the service reference of the WSDL provided. I have to make client authentication and message signing before the message send to the server. I have done the client authentication, kindly help me to provide how the message signing can be done while passing an object to the wsdl generated class.
 
ServiceReference1.Purchaseclass proxy = new ServiceReference1.Purchaseclass();
ServiceReference1.getSuppliersRequest obj = new ServiceReference1.getSuppliersRequest();
obj.companyId = "345";
ServiceReference1.getSuppliersResponse response = new ServiceReference1.getSuppliersResponse();
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls; proxy.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySubjectDistinguishedName, "‎test.mshq-client");
((BasicHttpBinding)proxy.Endpoint.Binding).Security.Mode = BasicHttpSecurityMode.Transport;
((BasicHttpBinding)proxy.Endpoint.Binding).Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;

// Then i have to make the message sign before calling the request to the API

response = proxy.GetSuppliers(obj); 

Answers (2)