Raritan Computer CC-WSAPI-0B-v5.1.0-E Marine Radio User Manual


 
Appendix C: Web Services Development in C#
40
4. Set a call back for ServerCertificateValidationCallback so that the
client will accept the CCSG's server certificate. A simple method is to
trust the certificate if it matches the CCSG server certificate that you
have explicitly saved from the CCSG. See Saving the CCSG's
Server Certificate Using IE6.
ServicePointManager.ServerCertificateValidationCall
back =
delegate(Object obj, X509Certificate
certificate, X509Chain chain, SslPolicyErrors
errors)
{
X509Certificate server_certificate =
X509Certificate.CreateFromCertFile(@"C:\cc_cert
ificate.cer");
return
server_certificate.Equals(certificate);
};
5. Create an instance of the service proxy.
6. Tell the proxy which client certificate to use through the
ClientCredentials member. You should save the client certificate into
a store. See Installing the Client Certificate into the Store. Specify
the store where you installed the certificate along with a name that
the search method can use to find the certificate. In this example,
10.0.0.150 is the address and FQDN of the client host and the
certificate is stored in the Personal section of the Current User store.
auth_service.ClientCredentials.ClientCertificate.Se
tCertificate(
StoreLocation.CurrentUser,
StoreName.My,
X509FindType.FindBySubjectName,
"10.0.0.150");
7. Create an instance of the service's parameters class (signOn for
instance).
8. Set the parameters.
9. Use the proxy and parameters object to access the service.
10. You can receive the response through the returned object
(signOnResponse for example).
Sample Application for C#