estoy desarrollando una integracion con un servicio y cuando prubo el servicio mediante un cliente restful funciona correctamente. Cuando intento hacer la integracion en .NET Framework con HttpClient que hago un request al servicio este me duevule un 500 sin mucha informacion.
ThunderClient Request:
Metodo c# usuando HttpClient:
public async Task<bool> UpdateSerial(string APID, string newSerial, string orderId)
{
var userName = ConfigurationManager.AppSettings["GatewayUserName"].ToString();
var password = ConfigurationManager.AppSettings["GatewayPassword"].ToString();
var credentials = new NetworkCredential(userName, password);
var handler = new HttpClientHandler { Credentials = credentials };
using (var _http = new HttpClient(handler))
{
if (string.IsNullOrEmpty(APID) || string.IsNullOrEmpty(newSerial) || string.IsNullOrEmpty(orderId))
throw new ArgumentException("Bad Request: Parameter Required serviceInstanceId, newSerial, orderId");
var url = new Uri(ConfigurationManager.AppSettings["GatewayURL"].ToString());
var ExtraData = new List<KeyValuePair> {
new KeyValuePair("APID", APID),
new KeyValuePair("NEW_SERIAL", newSerial),
new KeyValuePair("ORDER_NO", orderId)
};
var updateProductInstalledOTTRequest = new
{
extraData = ExtraData
};
var dataSerialized = JsonConvert.SerializeObject(updateProductInstalledOTTRequest);
var objectToSend = new StringContent(dataSerialized, Encoding.UTF8, "application/json");
var serverResponse = await _http.PostAsync(url, objectToSend).ConfigureAwait(false);
return serverResponse.IsSuccessStatusCode;
}
}
Error:
{StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content:
System.Net.Http.StreamContent, Headers:
{
Transfer-Encoding: chunked
X-ORACLE-DMS-ECID: 288e33c9-3bb9-4863-9aff-19556c0f80eb-0000d878
X-ORACLE-DMS-RID: 0
Date: Thu, 22 Sep 2022 14:07:02 GMT
Content-Type: application/xml
}}