Re: encapsulating webservice proxy to hide complexity



<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]


.



Relevant Pages

  • Re: ISA Server Problems, please help
    ... Based on the rules you have listed, SecureNAT clients should only be allowed ... The All access rule for SBS Internet Users ... Web Proxy and/or Firewall Client ... > header to the publishing server instead of the actual one. ...
    (microsoft.public.windows.server.sbs)
  • Re: ISA 2004 Web Proxy Clients
    ... Do I need to create WPAD cname record in DNS in concert with WPAD entries in ... Is it possible to propagate web proxy information to clients using WPAD ... proxy clients dont get proxy server address in LAN settings of IE.Another ...
    (microsoft.public.isa.clients)
  • RE: Web Pages Stall
    ... The clients can access the internet via IE7. ... All proxy settings are correct. ... Do you still need the ISA logs?? ...
    (microsoft.public.windows.server.sbs)
  • ICS and Proxy Settings
    ... Is there any way using ICS to tell its DHCP clients what proxy settings to ... I have 2-way satellite internet access at home (via ...
    (microsoft.public.windowsxp.general)
  • Re: DNS lookups and Sites and Services
    ... We have sites all over the country and in order to use our Proxy ... config file. ... Modern Windows clients do something very similar, ... Each of the DC's is a DNS server (DHCP ...
    (microsoft.public.win2000.active_directory)