update 20260220
This commit is contained in:
@@ -118,14 +118,14 @@ ELSE
|
||||
// 🔹 PDF GENERIEREN
|
||||
[System.Web.Http.HttpPost]
|
||||
[System.Web.Http.Route("GeneratePDF")]
|
||||
public async Task<HttpResponseMessage> GeneratePdf(JsonRequestDto dto)
|
||||
public HttpResponseMessage GeneratePdf(JsonRequestDto dto)
|
||||
{
|
||||
|
||||
|
||||
if (dto == null || string.IsNullOrWhiteSpace(dto.Json))
|
||||
return new HttpResponseMessage(HttpStatusCode.BadRequest);
|
||||
|
||||
byte[] pdfBytes = await CallExternalPdfApi(dto.Json);
|
||||
byte[] pdfBytes = CallExternalPdfApi(dto.Json);
|
||||
|
||||
var response = new HttpResponseMessage(HttpStatusCode.OK)
|
||||
{
|
||||
@@ -147,13 +147,13 @@ ELSE
|
||||
}
|
||||
|
||||
|
||||
private async Task<byte[]> CallExternalPdfApi(string json)
|
||||
private byte[] CallExternalPdfApi(string json)
|
||||
{
|
||||
|
||||
string ownHost = System.Configuration.ConfigurationManager.AppSettings["OwnHost"];
|
||||
string token = System.Configuration.ConfigurationManager.AppSettings["OwnToken"];
|
||||
string URL = ownHost + "API/DokumentGenerator";
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
var webRequest = System.Net.WebRequest.Create(URL);
|
||||
@@ -175,49 +175,17 @@ ELSE
|
||||
using (System.IO.StreamReader sr = new System.IO.StreamReader(s))
|
||||
{
|
||||
var jsonResponse = sr.ReadToEnd();
|
||||
System.Diagnostics.Debug.WriteLine(String.Format("Response: {0}", jsonResponse));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//System.IO.File.WriteAllText(@"x:\log.txt", ex.ToString());
|
||||
System.Diagnostics.Debug.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
//string URL = ownHost + "API/CreateCLM";
|
||||
//HttpWebRequest webRequest = HttpWebRequest.Create(URL) as HttpWebRequest;
|
||||
//webRequest.Method = WebRequestMethods.Http.Post;
|
||||
//webRequest.
|
||||
//webRequest.Headers["Authorization"] = "Bearer " + Token;
|
||||
//try
|
||||
//{
|
||||
// using (HttpWebResponse response = webRequest.GetResponse() as HttpWebResponse)
|
||||
// {
|
||||
// if (response.StatusCode == HttpStatusCode.OK)
|
||||
// {
|
||||
// StreamReader reader = new StreamReader(response.GetResponseStream());
|
||||
// string responseContent = reader.ReadToEnd();
|
||||
|
||||
// return responseContent;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Logging.Logging.Error(URL + ": " + response.StatusCode.ToString() + " / " + response.StatusDescription, "Client - GetImage", "");
|
||||
// return "";
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// return "";
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
string uri = ownHost + "/API/CreateCLM";
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user