473,725 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

encapsulating webservice proxy to hide complexity

I'm to deploy a .NET DLL which internally communicates with the WS. I
don't want others to see internal complexity of the web service
classes generated by "Add a Web reference" VS option.
As a WebSerive contains a lot of methods and different types creating
a web proxy class manually is too time consuming.

I tried to edit a class manually, changing the highest-level access
modifiers from public to internal - this way I could use the classes
from within the DLL, exposing only my API. However, this does not work
correctly - "some" of the classes have to be public (e.g. a class
defined as a SoapHeader, but not only) - when changing the access
modifier to internal, I got an error "Method XXX can not be reflected"
when trying to create an instance of the web proxy...

So the question is:
a) where could I find some information what is exactly done by
hte .NET framework during a proxy class lifetime
b) is there any other method (preferably automatic...) to hide as much
information as possible from the proxy class?
Thanks

May 16 '07 #1
10 7124
"roberto" <ro************ ****@gmail.comw rote in message
news:11******** **************@ u30g2000hsc.goo glegroups.com.. .
I'm to deploy a .NET DLL which internally communicates with the WS. I
don't want others to see internal complexity of the web service
classes generated by "Add a Web reference" VS option.
As a WebSerive contains a lot of methods and different types creating
a web proxy class manually is too time consuming.

I tried to edit a class manually, changing the highest-level access
modifiers from public to internal - this way I could use the classes
from within the DLL, exposing only my API. However, this does not work
correctly - "some" of the classes have to be public (e.g. a class
defined as a SoapHeader, but not only) - when changing the access
modifier to internal, I got an error "Method XXX can not be reflected"
when trying to create an instance of the web proxy...

So the question is:
a) where could I find some information what is exactly done by
hte .NET framework during a proxy class lifetime
b) is there any other method (preferably automatic...) to hide as much
information as possible from the proxy class?
Yes. You should write a second web service which abstracts the first. The
second service should try to be less fine-grained. That is, it should use an
SOA metaphor. You should then expose the second service.
--
John Saunders [MVP]

P.S. Of course, the alternative would be to have written the web service
that way to begin with, but if that's not an option, then a "proxy" service
is one way to fix the original without touching the code.
May 16 '07 #2
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
RefreshLocalCac he 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)

Thanks

May 17 '07 #3
(sorry if the similar message is already posted, but I don't see it on
the list since "successful " posting 3 hours ago...)

Web Service API is a minimal one, there is nothing to refactor. What I
want is to hide complexities of the proxy from third-party
applications using my DLL (not a WS).
Example: I'm exposing a .NET DLL with method UpdateLocalCach e(); it
transparently call some methods from the proxy:
GetFileList() x1
GetFileByName() x N
In this example I don't want the DLL's users to see GetFilexxx methods
(and all proxy additional details, e.g. timeouts, credentails etc.).

Don't get me wrong - I know the WS methods can be used either directly
from user generated proxies or from the web browser... I just don't
want to answer questions/problems like "how should I call the
method...." - and this will come, as developers tend to use
Intellisense withour bothering about documentation (btw, another issue
with the proxy class - it's not documented by default...).

Thanks

May 17 '07 #4
(sorry if the similar message is already posted, but I don't see it on
the list since "successful " posting 3 hours ago...)

Web Service API is a minimal one, there is nothing to refactor. What I
want is to hide complexities of the proxy from third-party
applications using my DLL (not a WS).
Example: I'm exposing a .NET DLL with method UpdateLocalCach e(); it
transparently call some methods from the proxy:
GetFileList() x1
GetFileByName() x N
In this example I don't want the DLL's users to see GetFilexxx methods
(and all proxy additional details, e.g. timeouts, credentails etc.).

Don't get me wrong - I know the WS methods can be used either directly
from user generated proxies or from the web browser... I just don't
want to answer questions/problems like "how should I call the
method...." - and this will come, as developers tend to use
Intellisense withour bothering about documentation (btw, another issue
with the proxy class - it's not documented by default...).

Thanks

May 17 '07 #5
On 16 Maj, 19:29, "John Saunders [MVP]" <john.saunder s at
trizetto.comwro te:
"roberto" <roberto.marchi c...@gmail.comw rote in message

news:11******** **************@ u30g2000hsc.goo glegroups.com.. .


I'm to deploy a .NET DLL which internally communicates with the WS. I
don't want others to see internal complexity of the web service
classes generated by "Add a Web reference" VS option.
As a WebSerive contains a lot of methods and different types creating
a web proxy class manually is too time consuming.
I tried to edit a class manually, changing the highest-level access
modifiers from public to internal - this way I could use the classes
from within the DLL, exposing only my API. However, this does not work
correctly - "some" of the classes have to be public (e.g. a class
defined as a SoapHeader, but not only) - when changing the access
modifier to internal, I got an error "Method XXX can not be reflected"
when trying to create an instance of the web proxy...
So the question is:
a) where could I find some information what is exactly done by
hte .NET framework during a proxy class lifetime
b) is there any other method (preferably automatic...) to hide as much
information as possible from the proxy class?

Yes. You should write a second web service which abstracts the first. The
second service should try to be less fine-grained. That is, it should usean
SOA metaphor. You should then expose the second service.
--
John Saunders [MVP]

P.S. Of course, the alternative would be to have written the web service
that way to begin with, but if that's not an option, then a "proxy" service
is one way to fix the original without touching the code.- Ukryj cytowanytekst -

- Poka¿ cytowany tekst -
(sorry if the similar message is already posted, but I don't see it on
the list since "successful " posting 3 hours ago...)

Web Service API is a minimal one, there is nothing to refactor. What I
want is to hide complexities of the proxy from third-party
applications using my DLL (not a WS).
Example: I'm exposing a .NET DLL with method UpdateLocalCach e(); it
transparently call some methods from the proxy:
GetFileList() x1
GetFileByName() x N
In this example I don't want the DLL's users to see GetFilexxx methods
(and all proxy additional details, e.g. timeouts, credentails etc.).

Don't get me wrong - I know the WS methods can be used either directly
from user generated proxies or from the web browser... I just don't
want to answer questions/problems like "how should I call the
method...." - and this will come, as developers tend to use
Intellisense withour bothering about documentation (btw, another issue
with the proxy class - it's not documented by default...).

Thanks

May 17 '07 #6
"roberto" <ro************ ****@gmail.comw rote in message
news:11******** *************@k 79g2000hse.goog legroups.com...
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
RefreshLocalCac he 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 RefreshLocalCac he operation in it.
--
John Saunders [MVP]
May 17 '07 #7
On 17 mayo, 19:04, "John Saunders [MVP]" <john.saunder s at
trizetto.comwro te:
"roberto" <roberto.marchi c...@gmail.comw rote in message

news:11******** *************@k 79g2000hse.goog legroups.com...


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
RefreshLocalCac he 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 RefreshLocalCac he 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.

Thanks

May 22 '07 #8
<mi******@gmail .comwrote in message
news:11******** **************@ x18g2000prd.goo glegroups.com.. .
On 17 mayo, 19:04, "John Saunders [MVP]" <john.saunder s at
trizetto.comwro te:
>"roberto" <roberto.marchi c...@gmail.comw rote in message

news:11******* **************@ k79g2000hse.goo glegroups.com.. .


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
RefreshLocalCac he 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 RefreshLocalCac he 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(par am);
int ret2 = svc.Method2(ret 1);
int ret3 = svc.Method3(ret 2);
// Do something with ret3

you would have:

// Get param from somewhere
NewProxyClass pxy = new NewProxyClass() ;
int ret3 = pxy.SimplerMeth od(param);
// Do something with ret3
--
John Saunders [MVP]
May 22 '07 #9
On 17 mayo, 19:04, "John Saunders [MVP]" <john.saunder s at
trizetto.comwro te:
"roberto" <roberto.marchi c...@gmail.comw rote in message

news:11******** *************@k 79g2000hse.goog legroups.com...


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
RefreshLocalCac he 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 RefreshLocalCac he 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.

Thanks

May 22 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
768
by: Davie | last post by:
I want to authorise a user of a web service by using the AuthHeaderValue for some reason I keep getting a null reference exception when I try to run the following code: It seems to work fine on a .NET Framework application, but just not on the .NET CF version. Can anyone suggest anything that might be wrong with the code? (I could post the app and webservice, but i was hoping that you might have noticed something from the supplied...
4
1692
by: Flare | last post by:
OK. I'll try explain my problem so simple as possible. I have to send a complex data type to a WebService from a Asp.net webapplication. My Data type look like this. (A class with a porperty) ------------- namespace Elsam.Turabs.ClassLibraries.TurabsLogExeption{
2
5711
by: Miguel | last post by:
Hi, I'm developing an application in C# with Windows Forms for my company that is similar to the MSN Messenger. This application uses a webservice for registering users, etc... and as 2 webbrowser controls on it. Besides that i'm using the firewall client for isa server 2004 and it seems that the browsers aren't able to pass thru it... if i disable the firewall the browsers work fine, if i don't, the 2 browsers just stay there...
7
5402
by: stephan querengaesser | last post by:
hi ng, i try to invoke a webservice-method with an filter-object, that contains value types. if i don´t want to filter the return value of the method, i have to pass a new instance of the filter-object without setting any properties. but the value type-properties can´t be null and the filter is set to 0 (int) or false (bool). therefore i did implement the propertySpecified-pattern like this:
7
2924
by: Nalaka | last post by:
Hi, I created a sinple web service that returns a dataSet. Then I created a client program that uses this web service (that returns the Dataset). My question is, how did the client figure out to create a "DataSet" as the return type from the webservice?
3
2262
by: Mark | last post by:
I'm consuming a webservice that makes a simple object available. The object class is marked in the web service as . I have a web application that consumes and uses this web service's class. When I receive the object from the web service, I'm interested in storing that object in ViewState in the web application, but I receive the error below. I'm not shocked that the web application can't serialize the object as the attribute isn't...
4
5996
by: Boni | last post by:
I want consuming a webserivce trough a proxy. I use this code. myService s = new myService (); System.Net.WebProxy proxyObject = new System.Net.WebProxy("http://proxyhost:8080"); s.Proxy = proxyObject; It doesn't works, it returns a error HTTP 407: Proxy Authentication Required ( Access is denied. ). But my proxy don't need a user Authentication.
0
1195
by: roberto | last post by:
Sorry, but posting a reply does no work (6 hours after the "successful" post the message is not shown)) so I decided to post it. This is a reply to a thread http://groups.google.pl/group/microsoft.public.dotnet.framework.webservices/browse_thread/thread/1de13b5ef20c837a/78006eaa8e840fd1#78006eaa8e840fd1 Web Service API is a minimal one, there is nothing to refactor. What I want is to hide complexities of the proxy from third-party...
2
3484
by: =?Utf-8?B?TGFycnlLdXBlcm1hbg==?= | last post by:
Our WebDev team seems to have found a problem that exposes a bug in .NET 2.0. This problem can be shown when trying to access a WebService using SSL and through a proxy server after using the HttpWebRequest object. Under normal circumstances I am able to use the webservice without any problems. But after using an HttpWebRequest object to make a call to a website all subsequent attempts to use the WebService will fail with a 401...
0
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8099
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.