.NET Remoting vs. Web Services
-
Hello, I hope this is not considered a programming question, since it's more on the technology itself than on how to do something specific. I'm designing a smart client application that will be used in several locations (around 100) around the world. It will be using a leased Windows 2003 server. One of the requirements is that it must have limited functionality when working offline (either by choice or because there is no connectivity.) Also, it must work with all firewalls (since I will not be going to Argentina to fix a firewall-related problem). At first I thought about using web services. They work with HTTP (and SSL) and once I have some data locally, I can work offline perfectly. But I've been learning lately about .NET remoting and it seems I could use it as well. And it's even better that I can use it with IIS and HTTP. Does anyone have any experience with something similar? what do you think? Thanks in advance, -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
You might want to look at MSMQ as well. E=mc2 -> BOOM
-
[Copy/Paste from my post[^] above] "One thing I don't really like about web services is that if I return from the web method my business object (a
Customer
object) on the client I get a pseudo-Customer class that only contains fields (not properties or methods.) I looked into custom serialization, but I didn't find it possible for web services. That's one of the things that made me actually consider remoting." In a previous application I developed with web services, to overcome this problem I had to create a wrapper class that would call the web service, and then fill a real business object and return it to the caller. With some 25 methods it was 2000 lines of code that I had to be mantaining if I added another property to any of the classes. I really would like to avoid it, since this new application will be many times bigger. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
If you add new properties or methods, you are "breaking" the message contract. Web services would force you to properly version the change, so that "old" clients could still do business with the service, while new clients could take advantage of the new features. Remoting will exhibt just as strict a requirement, if you add to the public interface of the business object, old clients won't recognize any of it (unless maybe, you cheat, and keep the strong name key and version info the same). If you don't keep your client's understanding of the business object the same as your server's, how do you expect to reliably debug issues? Sometimes there is no avoiding maintenance. Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke
-
If you add new properties or methods, you are "breaking" the message contract. Web services would force you to properly version the change, so that "old" clients could still do business with the service, while new clients could take advantage of the new features. Remoting will exhibt just as strict a requirement, if you add to the public interface of the business object, old clients won't recognize any of it (unless maybe, you cheat, and keep the strong name key and version info the same). If you don't keep your client's understanding of the business object the same as your server's, how do you expect to reliably debug issues? Sometimes there is no avoiding maintenance. Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke
Rob Graham wrote:
If you add new properties or methods, you are "breaking" the message contract.
This was when the app was under development, not after it was released. I make my little Customer class, and its related web methods. Then I add another field to the Customer class and I have to go modify all the web method calls. That's the maintenance I want to avoid. But first of all, I want to avoid writing those wrapper classes. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-
Rob Graham wrote:
If you add new properties or methods, you are "breaking" the message contract.
This was when the app was under development, not after it was released. I make my little Customer class, and its related web methods. Then I add another field to the Customer class and I have to go modify all the web method calls. That's the maintenance I want to avoid. But first of all, I want to avoid writing those wrapper classes. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
I think you have a design issue. What passes between the client and server in the web method should be a simple (data only) object, whose content (public fields) both sides understand (as represented by the XSD definition of the object). Putthe methods in a separate dll that contains or uses a message class instance created by deserializing the message. The message class definitions (and any shared constants,etc. should be in its own dll, which both client and server use to itantiate instances... Your webmethod should just have an instance of the message object as its message data parameter, you shouldn't have to change any webmethod if you change the internals of the message. Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke
-
It seems that Remoting is right for the job in your case. I suggest you take a look at Rocky Lhotka[^]'s Expert Business Object book... it will help you use Remoting properly and design your application to make the most out of it. Shameless plug: my copy of the book is for sale :) Carl Mercier Geek entrepreneurs, visit my blog! [^]
Carl Mercier wrote:
Rocky Lhotka[^]'s Expert Business Object
I'm looking into it already... interesting framework altough it seems a little bit too complex for this particular application. Is it suitable for small apps? -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-
I think you have a design issue. What passes between the client and server in the web method should be a simple (data only) object, whose content (public fields) both sides understand (as represented by the XSD definition of the object). Putthe methods in a separate dll that contains or uses a message class instance created by deserializing the message. The message class definitions (and any shared constants,etc. should be in its own dll, which both client and server use to itantiate instances... Your webmethod should just have an instance of the message object as its message data parameter, you shouldn't have to change any webmethod if you change the internals of the message. Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke
So that means I should convert my Customer business object to something like a pseudo-Customer that only has fields for Name, LastName and so on, send that through the webmethod, and convert it back to a real Customer in the client? It's that conversion from Customer to pseudo-Customer and back that I want to avoid. That more or less what I did in my other application, except that the conversion from a business object to the pseudo-business object (the message object) was done automatically, but I had to make it back to a real business object on the client side (an
ArrayList
is serialized as an array automatically, but I had to make it back into anArrayList
on the client). I was thinking that all my business objects could contain two methods: a staticFromMessageObject
that would construct an object from that message object, and aToMessageObject
that would return a message object from the actual object. But then, one question. When I add the webservice reference in VS, how can I make it generate methods that return my message objects (in my own DLL) instead of generating stub classes? (This might actually be considered a programming question! :rolleyes:) -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-
Carl Mercier wrote:
Rocky Lhotka[^]'s Expert Business Object
I'm looking into it already... interesting framework altough it seems a little bit too complex for this particular application. Is it suitable for small apps? -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
I found it a little complex also, that's why we rolled our own. However, we don't use Remoting for that particular application I'm talking about. I think things can go fairly well, even for small apps, if you use code generators (CodeSmith for example). There's a bunch of CSLA templates available online. Carl Mercier Geek entrepreneurs, visit my blog! [^]
-
So that means I should convert my Customer business object to something like a pseudo-Customer that only has fields for Name, LastName and so on, send that through the webmethod, and convert it back to a real Customer in the client? It's that conversion from Customer to pseudo-Customer and back that I want to avoid. That more or less what I did in my other application, except that the conversion from a business object to the pseudo-business object (the message object) was done automatically, but I had to make it back to a real business object on the client side (an
ArrayList
is serialized as an array automatically, but I had to make it back into anArrayList
on the client). I was thinking that all my business objects could contain two methods: a staticFromMessageObject
that would construct an object from that message object, and aToMessageObject
that would return a message object from the actual object. But then, one question. When I add the webservice reference in VS, how can I make it generate methods that return my message objects (in my own DLL) instead of generating stub classes? (This might actually be considered a programming question! :rolleyes:) -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
Edit what it creates, and change the webmethods to suit yourself? (I haven't tried hosting the service in IIS, so I had to write the webmethods myself) this[^] artilce and this one[^] have some good starting points and examples. Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke
-
Edit what it creates, and change the webmethods to suit yourself? (I haven't tried hosting the service in IIS, so I had to write the webmethods myself) this[^] artilce and this one[^] have some good starting points and examples. Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke
Thanks, I'll look into them! -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-
Hello, I hope this is not considered a programming question, since it's more on the technology itself than on how to do something specific. I'm designing a smart client application that will be used in several locations (around 100) around the world. It will be using a leased Windows 2003 server. One of the requirements is that it must have limited functionality when working offline (either by choice or because there is no connectivity.) Also, it must work with all firewalls (since I will not be going to Argentina to fix a firewall-related problem). At first I thought about using web services. They work with HTTP (and SSL) and once I have some data locally, I can work offline perfectly. But I've been learning lately about .NET remoting and it seems I could use it as well. And it's even better that I can use it with IIS and HTTP. Does anyone have any experience with something similar? what do you think? Thanks in advance, -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
I see you are from Mexico, here is an article on spanish about this issue: http://metodos.lnds.net/2005/10/web\_services\_u\_object\_remoting.html
-
I see you are from Mexico, here is an article on spanish about this issue: http://metodos.lnds.net/2005/10/web\_services\_u\_object\_remoting.html
Muchas gracias!! Interesante lectura! :) For all of you who don't speak Spanish: "thank you very much, interesting read". -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005