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 4545282
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:47:30+00:00 2026-05-21T15:47:30+00:00

Im required to listen requests from a web service in C# and respond to

  • 0

Im required to listen requests from a web service in C# and respond to them ion C# .. whats the approach to this ?

  • 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-05-21T15:47:30+00:00Added an answer on May 21, 2026 at 3:47 pm

    I am presuming you already have a web service you wish to consume. There are several examples on consuming web services on the web (e.g.: Consuming web services from a WinForms app).

    Adding a web reference

    First, you need to add a web reference to your C# project. In VS2005, you can do this by right-clicking the project and selecting “Add web reference”, and the providing the url of the web service. In VS2008 or newer, there are a couple of extra clicks as described here.

    After you’ve done that, VS will generate all the necessary proxy classes for you, with methods for both synchronous and asynchronous invocation, which you can use as if the object was instantiated locally.

    Viewing generated classes

    For example, if your web service has a single method (DoSomething), and is located at www.example.com/MyService.asmx (and also named “MyService”), Visual Studio will create a class called `MyService” which will look something like this:

    namespace MyNamespace // <-- this is the name you choose when you 
    {                     //     added the web reference
    
        public class MyService : SoapHttpClientProtocol
        {
             // synchronous execution
             public void DoSomething()
             {
    
             }
    
             // async execution
             public void DoSomethingAsync()
             {
    
             }
    
             // callback event for async execution
             public event DoSomethingCompletedEventHandler DoSomethingCompleted;
         }
    }
    

    To examine the contents of the generated namespace, double click your web reference in Solution Explorer (it should be inside a folder called “Web References”). This will open the Object browser.

    Using generated classes synchronously

    The simplest way to use your class is to create an instance, and invoke the method:

    // create a new instance of the service
    MyService service = new MyService();
    
    // invoke the method
    service.DoSomething(); // <-- this will block the thread until completed
    

    Using generated classes asynchronously

    To use the async version, you can attach an event handler:

    // create a new instance of the service
    MyService service = new MyService();
    
    // attach the event handler
    service.DoSomethingCompleted += MyEventHandler;
    
    // invoke the method asynchronously
    service.DoSomethingAsync(); // <-- this will be invoked on a background thread
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We use @Constraint.Required to validate the fields of our forms, and this generates a
What is the NSFormat required for a string like this? Fri, 15 Jun 2012
Given code like this from a node.js neophyte like me: require('http').createServer(function( req, resp )
I'm trying to develop an agent/client that will listen to HTTP requests on a
I'm writing a daemon in Java that takes in requests from multiple providers in
When making requests in Node.JS to another HTTP server, you can listen for when
I have a web application built on ASP.NET MVC framework which requires a service
The following is the example web server from the documentation, with an added counter.
My sio = require('socket.io').listen(app) is in my server.js file, but I'm calling a method
Advice required on architecting module I have a PORT Listener that listens to a

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.