Ambiguous Web Service References

G

Guest

Background:
I am building a Windows enterprise application that has separate assemblies
for UI, business logic/rules, and data access (i.e. typical N-tier
architecture). Many of the assemblies reference a "name and address web
service," which gives me validation lists for name honorifics (e.g. Dr, Mr,
Miss, Mrs), name suffixes (e.g. Sr, Jr, III), and City/State/ZIP combos. The
same name and address web service also can save and retrieve addresses.
Obviously, it's a pretty generic little web service that gets used in
multiple places in the app (return addresses for mailings; contact info for
A/R accounts; and more). Multiple assemblies have need to use the web service.

The Problem:
If each assembly has a reference to the same web service and names the proxy
the same thing (i.e. NameAndAddressWebService), then I start getting
ambiguous reference errors popping up everywhere. If I name all the web
references differently, then I'm okay. But I have to be careful that all my
references truly have different names, even those "built into" other
assemblies developed by other programmers. Some options:
1) Why can't web references be marked "Friend" so their visibility is
restricted to the assembly that they're declared in? The VS2005-generated
code always generates "Public" proxy objects. (I can go into the Reference.vb
and change everything from Public to Friend, but that seems like a really
dangerous thing to do; "Update Web Reference" wipes out all these manual
override changes.)
2) I can create a wrapper assembly that essentially just has the web
reference proxy objects in it (i.e. NameAndAddressWSProxy.dll). I can then
reference this assembly from all my other assemblies and everything works.
But wrapping a web service seems hokey.
3) I could scrap the whole name and address web service and just turn it
into a standard Windows assembly (Windows Class Library). At this point, I'm
just not seeing the advantage of having this functionality in a web service
(heresy, I know!).

I've been looking for some best practices, or at least "here's-what-we-did",
articles, but I haven't found anything yet. Recommendations?
 
G

Guest

The Problem:
If each assembly has a reference to the same web service and names the
proxy the same thing (i.e. NameAndAddressWebService), then I start
getting ambiguous reference errors popping up everywhere.

Use the fully qualified name:

i.e.: Namespace.Class.Object


If I name
 
G

Guest

Spam Catcher -

My multiple UI assemblies all have the same namespace:
<root_namespace>.Action.Clerk.UserInterface

My business logic/rules assemblies all have the same namespace:
<root_namespace>.Action.Clerk.BusinessObjects

And my data access assemblies all have the same namespace:
<root_namespace>.Action.Clerk.DataObjects

So using the fully qualified name still doesn't resolve the ambiguities.
Again, I go back to the fact that web references can't be isolated to the
assembly that they're declared in; the proxy objects are in fact declared as
Public, which exposes them throughout any solution that the assemblies are
used in. This seems like a pretty big shortcoming to me.

:
Use the fully qualified name: i.e.: Namespace.Class.Object
 
G

Guest

Spam Catcher -

My multiple UI assemblies all have the same namespace:
<root_namespace>.Action.Clerk.UserInterface

You shouldn't be naming your assemblies with all the same name.

Is there a reason why they're all the same?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top