/// <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(WramServiceProxy webService,
                    Int32 operationTimeoutMinutes,
                    Int32 operationTimeoutSeconds = 0)
 {
     _operationTimeout = (operationTimeoutMinutes * 60) + operationTimeoutSeconds;
     _webService       = webService;
     _client           = (WramSpeciesDataChangeServiceClient)(_webService.PopClient(_operationTimeout));
     _webService.SetTimeout(Client.Endpoint.Binding, _operationTimeout);
 }
        /// <summary>
        /// Create a web service client.
        /// </summary>
        /// <returns>A web service client.</returns>
        protected override Object CreateClient()
        {
            WramSpeciesDataChangeServiceClient client;

            client = new WramSpeciesDataChangeServiceClient(GetBinding(), GetEndpointAddress());

            // Increase data size for all methods that
            // sends or receives a lot of data.
            IncreaseDataSize("GetSpeciesObservationChangeAsSpecies", client.Endpoint);

            return(client);
        }
            /// <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;
            }