How to add UsernameToken to RequestSoapContext property of web service proxy class

I have a service that I refer to that creates a proxy class called "MyWebService". However, when I use this class, its object does not have the RequestSoapContext property. The following is an example of how I expected to use this service:

            MyWebService objWS = new MyWebService();
            UsernameToken token = new UsernameToken("User","Password", PasswordOption.SendPlainText);
            objWS.RequestSoapContext.Security.Timestamp.TtlInSeconds = 60;
            objWS.RequestSoapContext.Security.Tokens.Add(token);
            objWS.RequestSoapContext.Security.MustUnderstand = false;

Is there some kind of configuration / modification that I need to do for the generated proxy class so that I can get RequestSoapContext in the proxy class or do I need to do something on the service side?

Thank you for your time...

+3
source share
1 answer

-, - , reference.cs. , . , - System.Web.Services.xxxx.

MyWebService: Microsoft.Web.Services3.WebServicesClientProtocol

+6

Source: https://habr.com/ru/post/1765957/


All Articles