tags:

views:

43

answers:

1

Hi There,

can i implement a SOAP Service which can deal with delegates/events?? Can i also use Streams with SOAP? How does it look like in C#?

thanks, el

+1  A: 

Hello,

The SOAP protocol is based on top of HTTP so cannot act as a 'PUSH' service without doing heavy tricks => you cannot easily create an event-based webservice in ASP.NET.

You cannot use Streams neither but you can transmit binary content using byte[] parameters or return types. This is how it looks like in C# :

///Server side
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service1 : System.Web.Services.WebService
{

    [WebMethod]
    public byte[] GetFile(string fullName)
    {
        return File.ReadAllBytes(fullName);
    }
}

///Client Side
private void button1_Click(object sender, EventArgs e)
{
    Service1 client = new Service1();
    pictureBox1.Image = Image.FromStream(
        new MemoryStream(
            client.GetFile("c:\\apple.jpg")));
}

That's it.

Manitra Andriamitondra