问题描述
大家好
美好的一天!
我正在努力向a发送一个肥皂请求服务器。我添加了提供的WSDL的服务引用。在将消息发送到服务器之前,我必须进行客户端身份验证和消息签名。我已经完成了客户端身份验证,请帮助我提供在将对象传递给wsdl生成的类时如何完成消息签名。
我是什么尝试过:
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;
//然后我必须在致电API请求之前发出消息标志
回复= proxy.GetSuppliers(obj);
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.
What I have tried:
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);
推荐答案
这篇关于肥皂消息签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!