Ambiguous Web Service References

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Q3JhaWc=?=

    #1

    Ambiguous Web Service References

    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. NameAndAddressW ebService), 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. NameAndAddressW SProxy.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 ?

  • Spam Catcher

    #2
    Re: Ambiguous Web Service References

    =?Utf-8?B?Q3JhaWc=?= <Craig@discussi ons.microsoft.c omwrote in
    news:059F8B3A-C013-46C5-A334-218D4702A4BB@mi crosoft.com:
    The Problem:
    If each assembly has a reference to the same web service and names the
    proxy the same thing (i.e. NameAndAddressW ebService), then I start
    getting ambiguous reference errors popping up everywhere.
    Use the fully qualified name:

    i.e.: Namespace.Class .Object


    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. NameAndAddressW SProxy.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 ?
    >
    >

    Comment

    • =?Utf-8?B?Q3JhaWc=?=

      #3
      Re: Ambiguous Web Service References

      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.

      "Spam Catcher" wrote:
      Use the fully qualified name: i.e.: Namespace.Class .Object

      Comment

      • Spam Catcher

        #4
        Re: Ambiguous Web Service References

        =?Utf-8?B?Q3JhaWc=?= <Craig@discussi ons.microsoft.c omwrote in
        news:6244CB9F-AFC2-4159-BD78-C23D23A1EF4F@mi crosoft.com:
        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?

        Comment

        Working...