Hello Everyone,
This is an interesting issue that needs the community's
attention and active participation. Lets begin from the top;
Microsoft Visual Studio.NET provides excellent and extensive integration for
working with ASP.NET Web Services. It provides a mechanism of adding a Web
Reference using a IDE feature. What this feature basically does is use the
WSDL utility(WSDL.exe) (DISCLAIMER: as I understand it!) and generate the
proxy for the web service and certain other artifacts. What is interesting
for the discussion is these certain other "artifacts". Lets take an example
to begin with;
I have a web service called MyWebService that contains a method MyMethod.
This method accepts a parameter of the type XYZDS that incidentally is a
typed-dataset. When the WSDL utility is parsing the WSDL of MyWebService, it
will inadvertently serialize the type-definition of XYSDS into the generated
proxy code. This is exactly where the issue lies. I have all my XSD's neatly
configured in dynamic link libraries (oops! class libraries) and other
projects that add a reference to MyWebService have reference to these DLLs.
However, as the default behaviour of adding a web reference is to force
serialize type definitions of unknown types, this DLL reference becomes
redundant and not useful. This is not the only consequence. If you take a
look at the Reference.cs file that is generated by the Add Web Reference
utility, you would notice that the size of the file is huge (of course, I am
assuming that I am using a lot of different typed-datasets...and incidentally
I am). I have seen Reference.cs to expand to the tune of 75 Kilolines of code
whereas the actual code written by myself and my team in a particular project
does not exceed 5 Kilolines. We also have multiple such client projects that
have a reference to some web service or the other. I can notice an adverse
affect on application performance when I have just two client projects. We
have another 18-20 projects more to go. All that automatic generated code is
going to;
1. make application hog more memory
2. slow down application performance due to repeated redundant common code
compilation
3. make maintainance a nightmare (if the schema changes, you would have to
Remove and add the webreference again). Although not a major issue in strict
terms, an issue just the same. Forgetting to refresh web reference will
create run time type-inconsistencies
4. does not support writing common client code that interacts with multiple
web services
My question is(ah! finally), how do we get around all these problems?
I have arrived at three possible solutions to this problem. However, I am
not sure which one to choose OR is there a better way to solve the problem at
hand. I want expert feedback from the community regarding this issue. All
help is appreciated.
LET THE DEBATE BEGIN!