WSE3 CTP
It's already been said a few places, but the WSE3 CTP appeared for download in the last couple of days from the MSDN website.
This wouldn't normally worry me, since I'm yet to actually find a use for any WSE stuff myself. I'm ot saying it's not useful, I'm only saying that so far I've had no need of it.
But this time when I read about it coming out, my pricked up a little, and I had to do some further investigations. There two things especially that I noticed (copied from the link above - the release notes):
1) ASP.NET Web services, otherwise known as ASMX Web services, can now be hosted outside of IIS, for example in console applications or NT services and called with the TCP/IP protocol. The existing lightweight, message-oriented, SOAP programming model SoapSender/ SoapReceiver classes remain.
2) Support for the W3C MTOM Recommendation to enable large amounts of binary data to be sent efficiently and securely.
Support for MTOM...yeah, whatever, sounds interesting, but I hadn't heard of it. In the last few hours I've since found out, and I think I can make some very good use of this. It actually works quite easily - enable a WSE3 feature, and all of a sudden your binary data gets sent as actual binary data. Yay! For those that don't know, without this support all binary data gets base64 encoded, which bloats out the amount of network traffic on a ratio of 3:4 (your data gets made a third bigger).
But the one I particularly is the ability to host a web service within any application, not just a web application.
Think about it. Got two applications that need to talk to each other? How do you do it? Back in the dark ages, I would have written my own custom tcp/ip protocol to send messages between them, and have my own socket code binding to listen ports and stuff. Slightly less time ago, I would have done the same thing, but used the winsock control on my VB6 apps. There's also things like MSMQ, but that's not _direct_ communication. Since .net, I've almost never needed to do it. Web and Web Services are just too powerful to do it almost any other way (and if you need to do it another way, there's remoting).
But now who needs remoting?
I can think of at least two different applications at work that have been written where there's a windows service that polls a database looking for work to be done, and they each have a separate webservice as an entry point to give it work to do - and all the web services do is write data to the database so that the windows service can poll it and pick it up and some point later in time.
So no we have a windows service that instead of entering an infinite loop that checks for work and then sleeps for a while, it spawns off one of these inline webservices and just waits for people to hit it.
And now we're in a stateful environment, instead of a stateless web app, so we _can_ in the webmethod call spawn off a new thread to deal with the request, and, say, exit the web method immediately (in the cases where it's a request for work to be done, and not data to be sent back). How cool is that?
I'm excited.
Oh, and just to prove to myself that it really is that easy, I've already done it. The only trick I had was that once a web reference had been made (yeah, I cheated) you have to remember to instantiate the 'WebReferenceObjectWSE' class, not the 'WebReferenceObject' class.
And all it took was a very small amount of code.
This is the server (a winforms app):
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.Enabled = False
Dim oURI As New Uri("soap.tcp://localhost/testservice")
SoapReceivers.Add(New EndpointReference(oURI), GetType(MyWebService))
End Sub
And this is the client (another winforms app):
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oWS As New MyWebServiceTestWse
oWS.Url = "soap.tcp://localhost/testservice"
MsgBox(oWS.HelloWorld)
End Sub
Damn! I love it!