The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Fun With WSE 2.0

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Peter G Provost

Posts: 849
Nickname: pprovost
Registered: Aug, 2003

Peter G Provost is a Solution Architect for Interlink Group in Denver, CO.
Fun With WSE 2.0 Posted: Sep 10, 2003 1:19 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Peter G Provost.
Original Post: Fun With WSE 2.0
Feed Title: Peter Provost's Geek Noise
Feed URL: /error.aspx?aspxerrorpath=/Rss.aspx
Feed Description: Technology news, development articles, Microsoft .NET, and other stuff...
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Peter G Provost
Latest Posts From Peter Provost's Geek Noise

Advertisement

My boss has a demo coming up where he wanted to have a little private wireless network (not Internet connected) and he wanted to be able to send IM-like messages to all of the machines. He wanted the little "piece of toast" popup and to be able to send an arbitrary piece of text and a hyperlink.

Also, I've had a couple of WSE2 articles and MSDN TV downloads in my "To Be Reviewed" folder for a while now... why not use WSE2 to build this IM thingy?

I decided to use the WSE 2.0 Messaging API, which is very easy to use. You can literally send a message in less than 10 lines...

private void sendButton_Click(object sender,
System.EventArgs e) { Uri destination = new Uri("soap.tcp://" +
machineNameTextBox.Text + ":8888/WseMessenger"); SoapSender
soapSender = new SoapSender(destination); SoapEnvelope envelope
= new SoapEnvelope(); envelope.Context.Action = "Receiver";
XmlElement body = envelope.CreateBody(); body.InnerText = messageTextBox.Text; soapSender.Send(envelope);
} 

Pretty slick eh? Receiving is a little more complicated only in that you need to derive a new class from SoapReceiver:

using Microsoft.Web.Services; using Microsoft.Web.Services.Messaging; using System; public delegate void MessageReceivedEvent( object sender, 

SoapEnvelope envelope );
public
class MyReceiver : SoapReceiver { public event MessageReceivedEvent MessageReceived; protected override void Receive(SoapEnvelope envelope) { if( MessageReceived != null ) MessageReceived( this, envelope ); } }

Then from my Receiver Form I just add MyReceiver to the SoapReceivers collection and subscribe to the event:

private void Form1_Load(object sender,
System.EventArgs e) { MyReceiver receiver = new MyReceiver();
receiver.MessageReceived += new MessageReceivedEvent(receiver_MessageReceived);
SoapReceivers.Add( "soap.tcp://" + System.Net.Dns.GetHostName()
+ ":8888/WseMessenger", receiver ); }

Easy as pie! So now the question is... when will WSE 2.0 ship?

PS. This was all moot of course. I came into the office this morning and we decided to go with Microsoft Office Live Communication Server instead. Since we were running on a private little demo network anyway, why not? It was still fun to play around with the Messaging API.

PPS. If you are looking for a "piece of toast" control for C#/.NET, check out TaskbarNotifier by John O'Byrne. It is fully skinnable and very easy to use.

Read: Fun With WSE 2.0

Topic: The Zen of .NET: Vacation Continues Previous Topic   Next Topic Topic: Using SqlCeReplication with a WinForms App

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use