Web Service - Implement callback (C#)

Trips

Well-known member
Joined
Aug 7, 2010
Messages
2,788
Hello,
I have this file FirstService.asmx acting as a service


<div style="color:Black;background-color:White; <pre>
<%@ WebService language=<span style="color:#A31515; "C#" <span style="color:Blue; class=<span style="color:#A31515; "FirstService" %>

<span style="color:Blue; using System;
<span style="color:Blue; using System.Web.Services;
<span style="color:Blue; using System.Xml.Serialization;

[WebService(Namespace=<span style="color:#A31515; "http://localhost/test/")]
<span style="color:Blue; public <span style="color:Blue; class FirstService : WebService
{
[WebMethod]
<span style="color:Blue; public <span style="color:Blue; int Add(<span style="color:Blue; int a, <span style="color:Blue; int b)
{
<span style="color:Blue; return a + b;
}

[WebMethod]
<span style="color:Blue; public String SayHello()
{
<span style="color:Blue; return <span style="color:#A31515; "Hello World";
}
}
[/code]

and this file WinApp.cs acting as a client

<div style="color:Black;background-color:White; <pre>

<span style="color:Blue; using System;
<span style="color:Blue; using System.IO;

<span style="color:Blue; namespace SvcConsumer{
<span style="color:Blue; class SvcEater
{
<span style="color:Blue; public <span style="color:Blue; static <span style="color:Blue; void Main(String[] args)
{
FirstService mySvc = <span style="color:Blue; new FirstService();

Console.WriteLine(<span style="color:#A31515; "Calling Hello World Service: " + mySvc.SayHello());
Console.WriteLine(<span style="color:#A31515; "Calling Add(2, 3) Service: " + mySvc.Add(2, 3).ToString());
}
}
}
[/code]


I want the to modify the code so that the server uses callback to display the result at the client.
How can I achieve this?

Thanks.


View the full article
 
Back
Top