Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Asynchronous Web Service Calls from Client Application

Asynchronous Web Service Calls from Client Application

Scheduled Pinned Locked Moved C#
csharphelp
12 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Neeraj Kr
    wrote on last edited by
    #1

    Hi, I have made a web service and when I build the application and add the Web Reference in my Windows Application, I am not getting the Begin and End Method for making Asynchronous Web service calls. Its urgent. Kindly help. I am using C#.

    -----Have A Nice Day-----

    M P 2 Replies Last reply
    0
    • N Neeraj Kr

      Hi, I have made a web service and when I build the application and add the Web Reference in my Windows Application, I am not getting the Begin and End Method for making Asynchronous Web service calls. Its urgent. Kindly help. I am using C#.

      -----Have A Nice Day-----

      M Offline
      M Offline
      MCEdwards
      wrote on last edited by
      #2

      Did you manually create the web reference or did you use VS to generate the web reference? If you are using VS remove the reference to the web service and delete the generated cs file. Then add the reference again, there should be no probably with this since all the async behavior is controlled by .Net on the client application side. The remote server does not need to know anything about the async behavior of the client. If however you have created the class yourself you will need to manually add the async calls. Here are some useful links: http://msdn2.microsoft.com/en-us/library/d9w023sx(VS.71).aspx http://www.c-sharpcorner.com/UploadFile/ssrivastav/UsingAsynchronousWebServices11232005071049AM/UsingAsynchronousWebServices.aspx

      N 1 Reply Last reply
      0
      • N Neeraj Kr

        Hi, I have made a web service and when I build the application and add the Web Reference in my Windows Application, I am not getting the Begin and End Method for making Asynchronous Web service calls. Its urgent. Kindly help. I am using C#.

        -----Have A Nice Day-----

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        Please don't repost problems so quickly. It's unfair on others who have also posted questions. People answer questions here of their own free will, so you have to wait until they can get round to it. If it's really, really urgent, then you will have to post it on a site where people get paid to solve problems.

        Deja View - the feeling that you've seen this post before.

        N 1 Reply Last reply
        0
        • M MCEdwards

          Did you manually create the web reference or did you use VS to generate the web reference? If you are using VS remove the reference to the web service and delete the generated cs file. Then add the reference again, there should be no probably with this since all the async behavior is controlled by .Net on the client application side. The remote server does not need to know anything about the async behavior of the client. If however you have created the class yourself you will need to manually add the async calls. Here are some useful links: http://msdn2.microsoft.com/en-us/library/d9w023sx(VS.71).aspx http://www.c-sharpcorner.com/UploadFile/ssrivastav/UsingAsynchronousWebServices11232005071049AM/UsingAsynchronousWebServices.aspx

          N Offline
          N Offline
          Neeraj Kr
          wrote on last edited by
          #4

          Hi, I have done exactly according to the link provided by you. I created a webservice and added the reference in my windows application. I then created an object of the web service class and tried to call the Begin method, but the begin method does show up. I am not able to call the Begin method of my web method. Regards, Neeraj

          -----Have A Nice Day-----

          M 1 Reply Last reply
          0
          • P Pete OHanlon

            Please don't repost problems so quickly. It's unfair on others who have also posted questions. People answer questions here of their own free will, so you have to wait until they can get round to it. If it's really, really urgent, then you will have to post it on a site where people get paid to solve problems.

            Deja View - the feeling that you've seen this post before.

            N Offline
            N Offline
            Neeraj Kr
            wrote on last edited by
            #5

            I am so sorry, but I thought my previous question did not explain my problem well. I will keep this in mind for the next time.

            -----Have A Nice Day-----

            P 1 Reply Last reply
            0
            • N Neeraj Kr

              I am so sorry, but I thought my previous question did not explain my problem well. I will keep this in mind for the next time.

              -----Have A Nice Day-----

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              assiduous wrote:

              I thought my previous question did not explain my problem well

              Fair enough, but you should have modified that post instead.

              Deja View - the feeling that you've seen this post before.

              N 1 Reply Last reply
              0
              • P Pete OHanlon

                assiduous wrote:

                I thought my previous question did not explain my problem well

                Fair enough, but you should have modified that post instead.

                Deja View - the feeling that you've seen this post before.

                N Offline
                N Offline
                Neeraj Kr
                wrote on last edited by
                #7

                Yea True, Sorry Again.

                -----Have A Nice Day-----

                P 1 Reply Last reply
                0
                • N Neeraj Kr

                  Hi, I have done exactly according to the link provided by you. I created a webservice and added the reference in my windows application. I then created an object of the web service class and tried to call the Begin method, but the begin method does show up. I am not able to call the Begin method of my web method. Regards, Neeraj

                  -----Have A Nice Day-----

                  M Offline
                  M Offline
                  MCEdwards
                  wrote on last edited by
                  #8

                  Sorry my information is a little out of date. Things have changed it seems from 1.1 to 2. Anyway I created a quick test service and console app. You need to assign an event handler to the completed event for the method invoked. Then invoke the method using the async method call. The result of the method call is contained in the event args passed into the event handler. You have to think about the race condition between the main thread and the async thread when using this method of invoking the async call. Here is my code: static void Main(string[] args) { TestConsoleApp.localhost.Test Test = new TestConsoleApp.localhost.Test(); Test.HelloWorldCompleted += new TestConsoleApp.localhost.HelloWorldCompletedEventHandler(Test_HelloWorldCompleted); Test.HelloWorldAsync(); Console.ReadLine(); } static void Test_HelloWorldCompleted(object sender, TestConsoleApp.localhost.HelloWorldCompletedEventArgs e) { Console.Write(e.Result.ToString()); } Hope this makes sense

                  N 2 Replies Last reply
                  0
                  • M MCEdwards

                    Sorry my information is a little out of date. Things have changed it seems from 1.1 to 2. Anyway I created a quick test service and console app. You need to assign an event handler to the completed event for the method invoked. Then invoke the method using the async method call. The result of the method call is contained in the event args passed into the event handler. You have to think about the race condition between the main thread and the async thread when using this method of invoking the async call. Here is my code: static void Main(string[] args) { TestConsoleApp.localhost.Test Test = new TestConsoleApp.localhost.Test(); Test.HelloWorldCompleted += new TestConsoleApp.localhost.HelloWorldCompletedEventHandler(Test_HelloWorldCompleted); Test.HelloWorldAsync(); Console.ReadLine(); } static void Test_HelloWorldCompleted(object sender, TestConsoleApp.localhost.HelloWorldCompletedEventArgs e) { Console.Write(e.Result.ToString()); } Hope this makes sense

                    N Offline
                    N Offline
                    Neeraj Kr
                    wrote on last edited by
                    #9

                    So it means there is no concept of Begin and End Methods in 2.0

                    -----Have A Nice Day-----

                    M 1 Reply Last reply
                    0
                    • N Neeraj Kr

                      Yea True, Sorry Again.

                      -----Have A Nice Day-----

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #10

                      Don't sweat it. We all make mistakes - me especially.;)

                      Deja View - the feeling that you've seen this post before.

                      1 Reply Last reply
                      0
                      • N Neeraj Kr

                        So it means there is no concept of Begin and End Methods in 2.0

                        -----Have A Nice Day-----

                        M Offline
                        M Offline
                        MCEdwards
                        wrote on last edited by
                        #11

                        By the looks of it no, you will need to create a way of checking that all the async request have completed. For more info on async see: http://www.developer.com/net/net/article.php/11087\_3481691\_1 and for creating async ASP.NET pages that consume web services see: http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/

                        1 Reply Last reply
                        0
                        • M MCEdwards

                          Sorry my information is a little out of date. Things have changed it seems from 1.1 to 2. Anyway I created a quick test service and console app. You need to assign an event handler to the completed event for the method invoked. Then invoke the method using the async method call. The result of the method call is contained in the event args passed into the event handler. You have to think about the race condition between the main thread and the async thread when using this method of invoking the async call. Here is my code: static void Main(string[] args) { TestConsoleApp.localhost.Test Test = new TestConsoleApp.localhost.Test(); Test.HelloWorldCompleted += new TestConsoleApp.localhost.HelloWorldCompletedEventHandler(Test_HelloWorldCompleted); Test.HelloWorldAsync(); Console.ReadLine(); } static void Test_HelloWorldCompleted(object sender, TestConsoleApp.localhost.HelloWorldCompletedEventArgs e) { Console.Write(e.Result.ToString()); } Hope this makes sense

                          N Offline
                          N Offline
                          Neeraj Kr
                          wrote on last edited by
                          #12

                          Hi, All is well, but when I try to implement your Test_HelloWorldCompleted method, the HelloWorldCompletedEventArgs does not come up. I can only see the HelloWorldCompletedEventHandler.

                          -----Have A Nice Day-----

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups