Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class MedinectWebServiceExt : MedinectWebService.ServiceSoapClient, IDisposable
- {
- private bool isDisposed = false;
- ~MedinectWebServiceExt() => Dispose(false);
- public string Url
- {
- get { return base.Endpoint.Address.Uri.ToString(); }
- set { base.Endpoint.Address = new EndpointAddress(value); }
- }
- public double Timeout
- {
- get { return base.InnerChannel.OperationTimeout.TotalMilliseconds; }
- set { base.InnerChannel.OperationTimeout = TimeSpan.FromMilliseconds(value); }
- }
- public MedinectWebServiceExt(string url) : base(new WSHttpBinding { OpenTimeout = new TimeSpan(0, 10, 0), CloseTimeout = new TimeSpan(0, 10, 0), SendTimeout = new TimeSpan(0, 10, 0), ReceiveTimeout = new TimeSpan(0, 10, 0) }, new EndpointAddress(url))
- {
- base.ClientCredentials.ServiceCertificate.SslCertificateAuthentication =
- new X509ServiceCertificateAuthentication()
- {
- CertificateValidationMode = X509CertificateValidationMode.None,
- RevocationMode = X509RevocationMode.NoCheck
- };
- }
- public MedinectWebServiceExt(EndpointConfiguration endpointConfiguration = EndpointConfiguration.ServiceSoap) : base(endpointConfiguration)
- {
- base.ClientCredentials.ServiceCertificate.SslCertificateAuthentication =
- new X509ServiceCertificateAuthentication()
- {
- CertificateValidationMode = X509CertificateValidationMode.None,
- RevocationMode = X509RevocationMode.NoCheck
- };
- }
- protected virtual void Dispose(bool disposing)
- {
- if (isDisposed)
- return;
- try
- {
- if (base.State == CommunicationState.Faulted)
- base.Abort();
- else
- {
- try
- {
- base.Close();
- }
- catch (Exception closeException)
- {
- try
- {
- base.Abort();
- }
- catch (Exception abortException)
- {
- throw new AggregateException(closeException, abortException);
- }
- throw;
- }
- }
- }
- finally
- {
- isDisposed = true;
- }
- }
- public void Dispose()
- {
- // Dispose of unmanaged resources.
- Dispose(true);
- // Suppress finalization.
- GC.SuppressFinalize(this);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement