Re: How to convert a .NET application to webservice?



<ybi10@xxxxxxxxx> wrote in message news:1190829035.939182.217920@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

We have a product implmented with .NET (C#) as an application, it is
released as .exe file plus .dll files. Now we want to make it as
webservices, i.e. to make some of it's methods as webservices.

The questions are, do we have to modify the source code? Or can we
work with the existing .exe and dll files to make them webservices? We
are new to webservices, what will be the best way to complete the task
(making the application to webservices)?

The first thing to do is to design the web service. That is, to decide what part of the existing functionality should be exposed. The obvious answer to this question may not be the best answer.

Using your favorite analysis technique, try to find a set of operations that web service clients would want to use, are course-grained, stateless, and which do not expose details of your implementation.

Then, start by creating the "facade" of the web service. That would be the part that directly interacts with clients over the web.

When you get around to actually implementing the WebMethods of the service, you will find that you want to call some of the existing methods of your ..exe and .dll. If they're in the .dll, you may have nothing else to do other than reference the .dll in the web service project. If there are parts of the .exe that you need to access, then you'll want to refactor those and move them into the .dll (or into another, common .dll).

This way, you'll be creating a web service that your clients want to use, implemented to reuse existing code where possible, while not breaking the existing code.

I strongly recommend against using a rote, mechanical process to design the service. I've seen services which simply exposed all of the methods and properties of the public classes. These services were a mess to use and maintain, as they exposed the details of the original implementation.

Even when a web service is meant to expose all of the functionality of an existing application, it should be designed differently from the existing application. Web services have different needs than a Windows Forms application, for instance. Attempting to force a "round" web service into a "square" windows forms hole will create nothing but pain.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer

.



Relevant Pages

  • calling java from DOTNET 2? how stable or painfull?
    ... (sorry but i posted this in a dotnet newsgroup as well becoue i ... so i need to write an RMI CLIENT to this thing, and expose it microsoft ... at first we thought to have it exposed as web service and consume this ... service via dotnet dll. ...
    (comp.lang.java.programmer)
  • calling java from DOTNET 2? how stable painfull?
    ... so i need to write an RMI CLIENT to this thing, and expose it microsoft ... at first we thought to have it exposed as web service and consume this ... service via dotnet dll. ... developers which canno parse XML. ...
    (microsoft.public.dotnet.framework)
  • Re: How to expose a class in the Webservice.
    ... parameter in the WebMethods the web service and generate the Stubb class ... please be aware that even if your client referred to the same C# DLL ... The reson behind why i want to expose the classes with out using in the ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Internal access modifier is not working the way I thought it would.
    ... that DLL as a reference and use that class / method / field / etc. ... The programmers I'm referring to, I have never met, ... there is no way to include the web service in the DLL that I want to ... within the AccessUtils web service. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to expose a class in the Webservice.
    ... I have a webservice which uses a c# Dll,This Dll is a C# class library ... parameter in the WebMethods the web service and generate the Stubb ... What do you want to do with the class on the client if you don't want to ... The reson behind why i want to expose the classes with out using in the ...
    (microsoft.public.dotnet.framework.webservices)