/// <summary> /// Constructor for the ClientProxy class. /// Allocates an instance of the real web service client. /// </summary> /// <param name="webService">Web service proxy.</param> /// <param name="operationTimeoutMinutes">Operation timeout to set in the client. Unit is minutes.</param> /// <param name="operationTimeoutSeconds">Operation timeout to set in the client. Unit is seconds.</param> public ClientProxy(TaxonAttributeServiceProxy webService, Int32 operationTimeoutMinutes, Int32 operationTimeoutSeconds = 0) { _operationTimeout = (operationTimeoutMinutes * 60) + operationTimeoutSeconds; _webService = webService; _client = (TaxonAttributeServiceClient)(_webService.PopClient(_operationTimeout)); _webService.SetTimeout(Client.Endpoint.Binding, _operationTimeout); }
/// <summary> /// Implementation of the IDisposable interface. /// Recycle the client instance. /// </summary> public void Dispose() { if ((_client.State != CommunicationState.Opened) || (!_webService.PushClient(_client, _operationTimeout))) { // Client is not in state open or // was not added to the client pool. // Release resources. _client.Close(); } _client = null; }
/// <summary> /// Create a web service client. /// </summary> /// <returns>A web service client.</returns> protected override Object CreateClient() { TaxonAttributeServiceClient client; client = new TaxonAttributeServiceClient(GetBinding(), GetEndpointAddress()); // Increase data size for all methods that // sends or receives a lot of data. IncreaseDataSize("CreateSpeciesFacts", client.Endpoint); IncreaseDataSize("DeleteSpeciesFacts", client.Endpoint); IncreaseDataSize("GetLog", client.Endpoint); IncreaseDataSize("GetSpeciesFactsByIdentifiers", client.Endpoint); IncreaseDataSize("GetSpeciesFactsByIds", client.Endpoint); IncreaseDataSize("GetSpeciesFactsBySearchCriteria", client.Endpoint); IncreaseDataSize("UpdateSpeciesFacts", client.Endpoint); return(client); }