diff --git a/dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs b/dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs index 295e266a0..000729f1a 100644 --- a/dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs +++ b/dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs @@ -29,7 +29,11 @@ public GXRestAPIClient() Location.BaseUrl = "api"; Location.Host = "www.example.com"; Location.ResourceName = "service"; +#if NETCORE + Location.Port = 8082; +#else Location.Port = 80; +#endif } @@ -40,7 +44,7 @@ public GXRestAPIClient() public string ErrorMessage { get; set; } public int StatusCode { get; set; } - + public string StatusMessage { get ; set; } public int ResponseCode { get => responseCode; set => responseCode = value; } public string ResponseMessage { get => responseMessage; set => responseMessage = value; } public string HttpMethod { get => httpMethod; set => httpMethod = value; } @@ -336,6 +340,9 @@ public void AddUploadFile(string FilePath, string name) public void RestExecute() { this.ErrorCode = 0; + this.ErrorMessage = ""; + this.StatusCode = 0; + this.StatusMessage = ""; _queryString = String.Empty; if (_queryVars.Count > 0) { @@ -380,16 +387,16 @@ public void RestExecute() serviceuri += "/" + this.Location.BaseUrl.TrimEnd('/').TrimStart('/') + "/" + this.Location.ResourceName; serviceuri += _queryString; httpClient.HttpClientExecute( this.HttpMethod, serviceuri); + this.ErrorCode = httpClient.ErrCode; + this.ErrorMessage = httpClient.ErrDescription; + this.StatusCode = httpClient.StatusCode; + this.StatusMessage = httpClient.ReasonLine; if (httpClient.StatusCode >= 300 || httpClient.ErrCode > 0) { - this.ErrorCode = (httpClient.ErrCode == 0)? 1: httpClient.ErrCode; - this.ErrorMessage = httpClient.ErrDescription; - this.StatusCode = httpClient.StatusCode; _responseData = new Dictionary<string, object>(); } else { - this.StatusCode = httpClient.StatusCode; _responseData = GeneXus.Utils.RestAPIHelpers.ReadRestParameters(httpClient.ToString()); } } diff --git a/dotnet/src/dotnetframework/GxClasses/Helpers/GxObjectProperties.cs b/dotnet/src/dotnetframework/GxClasses/Helpers/GxObjectProperties.cs index 3ff58bd25..e954e8481 100644 --- a/dotnet/src/dotnetframework/GxClasses/Helpers/GxObjectProperties.cs +++ b/dotnet/src/dotnetframework/GxClasses/Helpers/GxObjectProperties.cs @@ -14,11 +14,13 @@ public class GxObjectProperties private string errorMessage = String.Empty; private int errorCode = 0; private int statusCode = 0; + private string statusMessage = String.Empty; public GxLocation Location { get => location; set => location = value; } public string ErrorMessage { get => errorMessage; set => errorMessage = value; } public int ErrorCode { get => errorCode; set => errorCode = value; } public int StatusCode { get => statusCode; set => statusCode = value; } + public string StatusMessage { get => statusMessage; set => statusMessage = value; } public int Protocol { get => protocol; set => protocol = value; } }