Esempio n. 1
0
        private UserWebservice(){
			_restClient = new RestClient (User.BaseURL());
            _currentUser = null;
            _anyError = null;
		}
Esempio n. 2
0
		/**
		 * Actual private method that fires up the web serivce client as tasks. This invokes the rest -client previously configured
		 * to return the output as resonse string from web serivce request. It throws any exception it encounters during task running.
		 * 
		 */ 
		private async Task<String> InvokeWebserviceAtURLAsync(string URLString)
        {
             var responseString = string.Empty;
			try
			{
                
				 responseString = await _restClient.MakeRequestAsync (URLString);
            }
			catch (HttpRequestException ex){
				throw new CustomHttpException (ex.Message);
			}
			catch (WebException ex){
				throw new CustomHttpException (ex.Message);
			}
            catch (JsonException ex)
            {
                _anyError = JsonConvert.DeserializeObject<APIError>(responseString);
            }

            return responseString;
            
        }