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 f5381db3a..aee97e8b7 100644 --- a/dotnet/src/dotnetframework/GxClasses/Helpers/HttpHelper.cs +++ b/dotnet/src/dotnetframework/GxClasses/Helpers/HttpHelper.cs @@ -689,7 +689,33 @@ internal static string JsonQuote(string value, bool addDoubleQuotes=false) return "\"" + text + "\""; } } - +#if !NETCORE + public static void SetSoapContext(GXSOAPContext value) + { + if (OperationContext.Current != null) + { + RequestMessageExtension ext = OperationContext.Current.Extensions.Find(); + if (ext == null) + { + ext = new RequestMessageExtension(); + OperationContext.Current.Extensions.Add(ext); + } + ext.SOAPContext = value; + } + } + internal static GXSOAPContext GetSoapContext() + { + if (OperationContext.Current != null) + { + RequestMessageExtension ext = OperationContext.Current.Extensions.Find(); + if (ext != null) + { + return ext.SOAPContext; + } + } + return null; + } +#endif } #if NETCORE public class HttpCookieCollection : Dictionary