Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8068423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:40:53+00:00 2026-06-05T12:40:53+00:00

I am hoping someone will be able to help me, I haven’t been programming

  • 0

I am hoping someone will be able to help me, I haven’t been programming in C# for a while. I’m sure the answer will be simple but i just can’t get my head around it.

I have the following, where i call System.Web.Services.Protocols.SoapHttpClientProtocol. I have included just one of the many calls that i have.

public partial class ExchangeService : System.Web.Services.Protocols.SoapHttpClientProtocol   {

//Lots of code using Soap 

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("getDetailsLite", RequestNamespace="http://www.MySite.com/ExchangeService/", ResponseNamespace=" http://www.MySite.com/ExchangeService/", ", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute("Result", IsNullable=true)]
    public GetDetailsLiteResp getDetailsLite(getDetailsLiteReq request) {
        object[] results = this.Invoke("getDetailsLite", new object[] {
                    request});
        return ((getDetailsLiteResp)(results[0]));
    }

    public void getDetailsLiteAsync(getDetailsLiteReq request) {
        this. getDetailsLiteAsync(request, null);
    }

    public void getDetailsLiteAsync (getDetailsLiteReq request, object userState) {
        if ((this.getDetailsLiteOperationCompleted == null)) {
            this.getDetailsLiteOperationCompleted = new System.Threading.SendOrPostCallback(this.OngetDetailsLiteOperationCompleted);
        }
        this.InvokeAsync("getDetailsLite", new object[] {
                    request}, this. getDetailsLiteOperationCompleted, userState);
    }
}

I want to override the WebRequest that the SoapHttpClientProtocol calls.
The SoapHttpClientProtocol looks like this (which I believe is called from System.Web.Services.dll)

namespace System.Web.Services.Protocols  {
    public class SoapHttpClientProtocol : HttpWebClientProtocol    {
    public SoapHttpClientProtocol();
    public SoapProtocolVersion SoapVersion { get; set; }
    protected IAsyncResult BeginInvoke(string methodName, object[] parameters, AsyncCallback callback, object asyncState);
    public void Discover();
    protected object[] EndInvoke(IAsyncResult asyncResult);
    protected virtual XmlReader GetReaderForMessage(SoapClientMessage message, int bufferSize);

    //This line is the one i am talking about
    protected override WebRequest GetWebRequest(Uri uri);

    protected virtual XmlWriter GetWriterForMessage(SoapClientMessage message, int bufferSize);
    protected object[] Invoke(string methodName, object[] parameters);
    protected void InvokeAsync(string methodName, object[] parameters, SendOrPostCallback callback);
    protected void InvokeAsync(string methodName, object[] parameters, SendOrPostCallback callback, object userState);
    }
}

I need protected the override WebRequest GetWebRequest(Uri uri ) to look like this:

protected override WebRequest GetWebRequest(Uri uri)  {
    HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri);
    webRequest.KeepAlive = false;
    webRequest.ProtocolVersion=HttpVersion.Version10;
    return webRequest;
}

Does anyone know how i would do this? I am uanble to edit it directly inside of the SoapHttpClientProtocol which im 99% sure i shouldn’t be doing anyway.

Thanks for any help you may be able to provide

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T12:40:55+00:00Added an answer on June 5, 2026 at 12:40 pm

    Subclass it? GetWebRequest is marked as virtual in the root class WebClientProtocol, so you can override the method.

    public class MyHttpProtocol : SoapHttpClientProtocol  
    {
        public override WebRequest GetWebRequest(Uri uri)
        {
            // Base request:
            WebRequest request = base.GetWebRequest(uri);
    
            // You code goes here...
    
            // Return...
            return request;
        }
    }
    

    Then use MyHttpProtocol as needed within your service class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a really simple question, but I am hoping someone will be able
I'm just having an issue I'm hoping someone will be able to give me
I am really hoping someone will be able to help me here. I am
I'm hoping someone have encountered this problem before and will be able to help
I have a semi-complicated problem and hoping that someone here will be able to
I have a very unusual situation that I am hoping someone will be able
I have a small question hoping someone will help me. Is there any way
Little to say ill just paste my code hoping that someone will see what
This could be a very basic question, but hopefully someone will be able to
Hoping that someone here will be able to provide some mysql advice... I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.