472,328 Members | 1,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

About proxy classes generated when adding a web reference

Hi all,

I'm quite lost with how adding web references to a project creates proxy
classes.

I've developed a web service with two classes inside and that contains three
references to three DLLs. After building it up, I've deployed it on the web
server.

From my Windows application, I then add a web reference to that web service.
This web reference shows me two proxy classes (correct because I have two
classes in my webservice). Besides, I can access another proxy class that has
been automatically generated and that maps with a Reference to a DLL. What
about the other two DLLs? I'm using the three DLLs surely.

So, being logical, automatically should have been generated another
aditional two proxy classes from these DLLs. Why adding the web reference
only generates one proxy class mapped to a DLL and let the other two without
mapping and without access.

Any rational or logical explanation will be very helpful to me.
Nov 21 '05 #1
3 5639
Hi Miguel,

When you create a web reference, VS.NET generates a web service proxy class
and optionally a bunch of other classes. These other classes reflect the
parameters and return types of your web methods. If a web method uses type
MyNamespace.XYZ in its parameters or return values, then a copy of that type
will be generated along with the proxy. Note that this copied type is not
the same type as the original type - it just has same name and same public
members but no private members.

To answer to your question about why some classes were not generated while
others were, without seeing the code, my guess is that the types that were
left out are not used as return values or parameters in the web methods.

Note that the XmlInclude attribute can be used to tell the XmlSerializer
about types that are not part of the static web method definition (i.e., if
a web method returns a base type but at runtime you return a derived type).

Regards,
Sami

"MIGUEL" <MI****@discussions.microsoft.com> wrote in message
news:0A**********************************@microsof t.com...
Hi all,

I'm quite lost with how adding web references to a project creates proxy
classes.

I've developed a web service with two classes inside and that contains three references to three DLLs. After building it up, I've deployed it on the web server.

From my Windows application, I then add a web reference to that web service. This web reference shows me two proxy classes (correct because I have two
classes in my webservice). Besides, I can access another proxy class that has been automatically generated and that maps with a Reference to a DLL. What
about the other two DLLs? I'm using the three DLLs surely.

So, being logical, automatically should have been generated another
aditional two proxy classes from these DLLs. Why adding the web reference
only generates one proxy class mapped to a DLL and let the other two without mapping and without access.

Any rational or logical explanation will be very helpful to me.


Nov 21 '05 #2
Thank you very much Sami.

You're rigth, as you tell me, types not used as return values or parameters
in the web methods aren't created as proxy classes. I don't use at all types
of the other two DLLs as return or parameter types. It's all clear for me now.

One more quetion: In order not to have DLLs deployed on the client side in
my Winforms application ("the thinner the client is the better"), I was
thinking about having the three DLLs deployed only on server side.

However, I don't know how to do it because I'm having problems. The
references on the web service are pointing to three DLLs located at different
places of the server. When I add these references and compile, in my bin
directory, are created the three DLLs. As they are pointing to another DLLs
located in another place in the disk (are redundant I think), I determine to
delete them from the "bin" directory. Nevertheless, it didn't work and gave
me an error telling that a DLL couldn't be found. It's a good idea to dop it
that way? I think having only the DLL of the web service in the "bin"
directory would be enough, wouldn't be? The DLLs are places in the correct
places, and th references are pointing to that places surely. I would like
your advice telling me if you see something strange going on there?

Besides, do you think it's a good idea to work in the Winforms application
only with instances of the proxy class generated? My goal is not to have
bussiness logic DLLs on the cleint side.

Regards and thanks again.
"Sami Vaaraniemi" wrote:
Hi Miguel,

When you create a web reference, VS.NET generates a web service proxy class
and optionally a bunch of other classes. These other classes reflect the
parameters and return types of your web methods. If a web method uses type
MyNamespace.XYZ in its parameters or return values, then a copy of that type
will be generated along with the proxy. Note that this copied type is not
the same type as the original type - it just has same name and same public
members but no private members.

To answer to your question about why some classes were not generated while
others were, without seeing the code, my guess is that the types that were
left out are not used as return values or parameters in the web methods.

Note that the XmlInclude attribute can be used to tell the XmlSerializer
about types that are not part of the static web method definition (i.e., if
a web method returns a base type but at runtime you return a derived type).

Regards,
Sami

"MIGUEL" <MI****@discussions.microsoft.com> wrote in message
news:0A**********************************@microsof t.com...
Hi all,

I'm quite lost with how adding web references to a project creates proxy
classes.

I've developed a web service with two classes inside and that contains

three
references to three DLLs. After building it up, I've deployed it on the

web
server.

From my Windows application, I then add a web reference to that web

service.
This web reference shows me two proxy classes (correct because I have two
classes in my webservice). Besides, I can access another proxy class that

has
been automatically generated and that maps with a Reference to a DLL. What
about the other two DLLs? I'm using the three DLLs surely.

So, being logical, automatically should have been generated another
aditional two proxy classes from these DLLs. Why adding the web reference
only generates one proxy class mapped to a DLL and let the other two

without
mapping and without access.

Any rational or logical explanation will be very helpful to me.


Nov 21 '05 #3
Comments inline:

"MIGUEL" <MI****@discussions.microsoft.com> wrote in message
news:A4**********************************@microsof t.com...
Thank you very much Sami.

You're rigth, as you tell me, types not used as return values or parameters in the web methods aren't created as proxy classes. I don't use at all types of the other two DLLs as return or parameter types. It's all clear for me now.
One more quetion: In order not to have DLLs deployed on the client side in
my Winforms application ("the thinner the client is the better"), I was
thinking about having the three DLLs deployed only on server side.

However, I don't know how to do it because I'm having problems. The
references on the web service are pointing to three DLLs located at different places of the server. When I add these references and compile, in my bin
directory, are created the three DLLs. As they are pointing to another DLLs located in another place in the disk (are redundant I think), I determine to delete them from the "bin" directory. Nevertheless, it didn't work and gave me an error telling that a DLL couldn't be found. It's a good idea to dop it that way? I think having only the DLL of the web service in the "bin"
directory would be enough, wouldn't be? The DLLs are places in the correct
places, and th references are pointing to that places surely. I would like
your advice telling me if you see something strange going on there?
That's how it works: when you create a reference to the DLLs from your web
service, the DLLs will be copied to the bin directory. You are supposed to
deploy the DLLs along with the web service DLL on the server, in the bin
directory.

Besides, do you think it's a good idea to work in the Winforms application
only with instances of the proxy class generated? My goal is not to have
bussiness logic DLLs on the cleint side.


The proxy classes are just simple data containers that give you type-safe
access to the web service parameter and return types. There is not much
business logic involved, so in my opinion it is perfectly ok.

Regards,
Sami
Nov 21 '05 #4

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

Similar topics

5
by: Benne Smith | last post by:
Hi, I have three enviroments; a development, a testing and a production enviroment. I'm making a big application (.exe), which uses alot of...
0
by: MIGUEL | last post by:
Hi all! Be patient because what I'm going to explain all of you it's more than very strange. I've developed a webservice project that contains...
3
by: Arpan | last post by:
Web Services make use of proxy classes whose methods & properties are accessed in exactly the same way as how a normal class' methods & properties...
3
by: Roy Chastain | last post by:
I have a schema that has been in existence over 1 year. I have been making a few minor modifications to it recently and suddenly the generated C#...
3
by: Joseph Geretz | last post by:
System.InvalidOperationException: WebServiceBindingAttribute is required on proxy classes. My environment: Visual Studio 2005, targeting FX 2.0;...
4
by: =?Utf-8?B?Sm9l?= | last post by:
I have a .NET class library called NorthwindLib and a class called Customer. I have a web server that exposes a web method GetCustomer() and returns...
2
by: Tham | last post by:
Hi I have written an assembly using the Class library template. I compiled a release version and registered in the GAC using gacutil. However...
2
by: Dinsdale | last post by:
We have created a object library that implements the INotifyPropertyChanged.PropertyChanged to bubble changes up to higher level classes. For...
3
by: Celal | last post by:
Hi, I couldn't get around a problem about decimal rounding up when adding a record to a table from a form by programming a button. I have an...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

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.