Re: encapsulating webservice proxy to hide complexity
- From: "John Saunders [MVP]" <john.saunders at trizetto.com>
- Date: Tue, 22 May 2007 13:24:12 -0400
<mifsilvi@xxxxxxxxx> wrote in message
news:1179847089.054476.147800@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 17 mayo, 19:04, "John Saunders [MVP]" <john.saunders at
trizetto.com> wrote:
"roberto" <roberto.marchic...@xxxxxxxxx> wrote in message
news:1179384928.085383.37570@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The question is not about server-side methods - they are optimised for
web access. The problem is that a client proxy DLL is to be used in
third-party application, so I'd like to hide its methods to not
confuse people when they try to use Intellisense.
The simpliest example: the web service gives a list of available files
and allows to download them one by one (e.g. GetFilesInfo,
GetFileByName). What I want to expose to DLL's clients is
RefreshLocalCache method, which will internally call the
aforementioned and take care of error handling etc. So - in this case
- I really don't want my Web Proxy class to be exposed...
As I said, nothing wrong WILL happen if somebody calls the WS either
directly or from the proxy; but by exposing too much I'll have to
respond to questions concerning the internal (from my POV) method
usage - who reads the documentation? developers use Intellisense....
(that's another argument against - web proxy methods don't have any
documentation by default)
Roberto, the point I was trying to make is that if you feel the need to
simplify the proxy classes, then you should consider simplifying the web
service. In particular, I would suggest simplifying it to more closely
align
with the ways your clients will be using the service. For instance, the
simplified service would have the RefreshLocalCache operation in it.
--
John Saunders [MVP]- Ocultar texto de la cita -
- Mostrar texto de la cita -
I have exactly the same problem as Roberto, and in my case I am not
the developer of the WebService, so I can not adapt it to my needs.
I would like to provide a simpler interface from my WS client DLL,
hiding most of the methods and types which are not needed for my DLL
clients.
I tried declaring the WS class as friend, but it didn't work. Any help
would be apreciated.
The suggestion I gave Roberto would be perfect for anyone who cannot modify
the web service - assuming you can create a proxy service of your own.
Another solution, which is so obvious that it's painful for me to admit it,
is to simply write a class library to entirely encapsulate all access to the
web service. Your clients don't even need to know which web service you're
calling. Instead of:
// Get param from somewhere
OriginalService svc = new OriginalService();
int ret1 = svc.Method1(param);
int ret2 = svc.Method2(ret1);
int ret3 = svc.Method3(ret2);
// Do something with ret3
you would have:
// Get param from somewhere
NewProxyClass pxy = new NewProxyClass();
int ret3 = pxy.SimplerMethod(param);
// Do something with ret3
--
John Saunders [MVP]
.
- References:
- encapsulating webservice proxy to hide complexity
- From: roberto
- Re: encapsulating webservice proxy to hide complexity
- From: John Saunders [MVP]
- Re: encapsulating webservice proxy to hide complexity
- From: roberto
- Re: encapsulating webservice proxy to hide complexity
- From: John Saunders [MVP]
- Re: encapsulating webservice proxy to hide complexity
- From: mifsilvi
- encapsulating webservice proxy to hide complexity
- Prev by Date: Re: encapsulating webservice proxy to hide complexity
- Next by Date: Re: encapsulating webservice proxy to hide complexity
- Previous by thread: Re: encapsulating webservice proxy to hide complexity
- Next by thread: Re: encapsulating webservice proxy to hide complexity
- Index(es):
Relevant Pages
|