Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions dotnet/src/dotnetframework/GxClasses/Helpers/GXRestAPIClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand All @@ -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; }
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}

Expand Down