![]() |
![]() |
Dev: Building Distributed Apps? Use XML Web Services, Not .NET Remoting (Mostly) By Paul Kimmel December 16, 2004
To do even more advanced things with Web services, you need to know more. The example invoked the Web service synchronously. This means the next line of code doesn’t execute until the Web method returns. If you have a long-running process, you may want to invoke the Web method asynchronously. Asynchronous invocation permits your code to go and do other things without waiting for the Web service to return. To use asynchronous Web services, you need to be comfortable with creating and using delegates. You also need to remember that the asynchronous Web method returned comes back on a separate thread from the invoking thread. You need to be comfortable with the concept of marshalling data across threads by using the Invoke method and more delegates. Also, you can pass and return composite types across Web services, but by default the client application works with a flattened, properties-only version of the composite type, except in the case of ADO.NET DataSets. You also can typecast a flattened Web service-defined proxy class to a class with methods, but this means deploying your business classes to consumers or consumers creating their own business classes. Deploying business classes is not recommended. Finally, you could use Dotfuscator to obfuscate — scramble the MSIL into gibberish — to prevent consumers from using Anakrino or Reflector to decompile your business classes, but again, you may not always be able to get your business classes deployed to consumer machines. Hence, it is better to design applications that use Web services in such a manner as to not need to deploy business classes. XML Web services in .NET are built on top of .NET Remoting. For all intents and purposes, a Web service is marshal-by-value .NET Remoting. The rumor mill also suggests that .NET Remoting may be completely concealed by XML Web services in the future, making advanced features of Remoting like event sinks available using Web services. I hope you are more comfortable with XML Web services. Now, when you have to choose between Remoting and Web services, you are prepared to make a decision. Most of the time when you create distributed applications, XML Web services will do. Paul Kimmel is the VB Today columnist for www.codeguru.com and has written several books on object-oriented programming and .NET. Check out his book Visual Basic .NET Power Coding from Addison-Wesley, and his upcoming book UML DeMystified from McGraw-Hill/Osborne (Spring 2005). Paul is also the founder and chief architect for Software Conceptions, Inc, founded 1990. He is available to help design and build software worldwide. You may contact him for consulting opportunities or technology questions at pkimmel@softconcepts.com. If you are interested in joining or sponsoring a .NET Users Group, check out www.glugnet.org. Copyright © 2004 by Paul Kimmel. All Rights Reserved.
|
||||||||||||||||||||||||||
![]() |
Featured
Links Learn the secrets of the popular search engines! Free Web Hosting Buyer's Guide -- Click Here! Enhance your Web site with the Dynamic HTML HierMenus Code |