From 869c02073871b3dc07c9032aba5bf4c3d35b8b6b Mon Sep 17 00:00:00 2001 From: claudiamurialdo Date: Wed, 29 Oct 2025 18:41:48 -0300 Subject: [PATCH] Define SetSoapContext and GetSoapContext as independent from GxContext. --- .../GxClasses/Core/GXApplication.cs | 27 +++++++++++++++++++ .../GxClasses/Helpers/HttpHelper.cs | 23 ++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/dotnet/src/dotnetframework/GxClasses/Core/GXApplication.cs b/dotnet/src/dotnetframework/GxClasses/Core/GXApplication.cs index cdc752bc4..d27db26b4 100644 --- a/dotnet/src/dotnetframework/GxClasses/Core/GXApplication.cs +++ b/dotnet/src/dotnetframework/GxClasses/Core/GXApplication.cs @@ -14,6 +14,7 @@ namespace GeneXus.Application using System.ServiceModel.Web; using GeneXus.UserControls; using System.Net.Http.Headers; + using System.ServiceModel; #else using Microsoft.AspNetCore.Http; using GxClasses.Helpers; @@ -4128,10 +4129,36 @@ public string ClientID } } + +#if NETCORE public GXSOAPContext SoapContext { get; set; } +#else + public GXSOAPContext SoapContext + { + get + { + return HttpHelper.GetSoapContext(); + } + set + { + HttpHelper.SetSoapContext(value); + } + } + +#endif + #endregion } +#if !NETCORE + public class RequestMessageExtension : IExtension + { + public GXSOAPContext SOAPContext { get; set; } + + public void Attach(OperationContext owner) { } + public void Detach(OperationContext owner) { } + } +#endif public class GxXmlContext { GXXMLReader _XMLR; diff --git a/dotnet/src/dotnetframework/GxClasses/Helpers/HttpHelper.cs b/dotnet/src/dotnetframework/GxClasses/Helpers/HttpHelper.cs index dbeabfce2..7a96a72dc 100644 --- a/dotnet/src/dotnetframework/GxClasses/Helpers/HttpHelper.cs +++ b/dotnet/src/dotnetframework/GxClasses/Helpers/HttpHelper.cs @@ -29,7 +29,6 @@ using System.Globalization; using System.Linq; using GeneXus.Http.Client; -using System.Net.Http.Headers; namespace GeneXus.Http { @@ -687,7 +686,27 @@ internal static string JsonQuote(string value, bool addDoubleQuotes=false) return "\"" + text + "\""; } } - +#if !NETCORE + public static void SetSoapContext(GXSOAPContext value) + { + RequestMessageExtension ext = OperationContext.Current.Extensions.Find(); + if (ext == null) + { + ext = new RequestMessageExtension(); + OperationContext.Current.Extensions.Add(ext); + } + ext.SOAPContext = value; + } + internal static GXSOAPContext GetSoapContext() + { + RequestMessageExtension ext = OperationContext.Current.Extensions.Find(); + if (ext != null) + { + return ext.SOAPContext; + } + return null; + } +#endif } #if NETCORE public class HttpCookieCollection : Dictionary