C# and Web References

From: Holly (hmarie_at_earthlink.net)
Date: 02/09/04


Date: 9 Feb 2004 11:26:53 -0800

Hi,

We have a web service that has mutliple levels; one for test, one for
QA and the other for production. With that, we also have one C#
component that accesses the web service depending on the level. What I
want to do is be able to compile the C# component once and have a
reference to all web services. There is code in the C# component to
indicate which web service to reference based on a registry setting.
However, the problem that I am having is that it fails to compile
because there are multiple instances to the same objects in the
different web references.

So, my question is: If I have the same web service setup in three
different locations knowing one is for testing, another for QA and
another for production how can I reference the ONE web reference I
need to use without having to compile it every time it moves to each
level?

Currently I have using statements setup to access each web reference.

Example Below:

using QAWebService;
using TestWebService;
using ProdWebService;

namespace Some.Namespace.Here
{
   public class SomeClass
    {
        //
        // Connect to the appropriate web service
        //
        switch (wsType)
        {
            case "TEST":
               TestWebService webService = new TestWebService();
               break;
            case "QA":
               QAWebService webService = new QAWebService();
               break;
            case "Prod":
               ProdWebService webService = new ProdWebService();
               break;
         }

         //
         // Instantiate/Initialize a single request shared between
         // each web service.
         //
         SomeRequest someReq = new SomeRequest();
                
         someReq.Version = 1;
    }
}

It fails compiling on the creation of "SomeRequest" because it is
ambiguous. Can anyone help?

Thanks,
Holly



Relevant Pages

  • Re: Web References how to config to read URL from config?
    ... any of the files on my development machine and the production version. ... > web service. ... > URLs (or simply switch the references to another web reference) easily ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Web References how to config to read URL from config?
    ... any of the files on my development machine and the production version. ... > web service. ... > URLs (or simply switch the references to another web reference) easily ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Web References how to config to read URL from config?
    ... any of the files on my development machine and the production version. ... > web service. ... > URLs (or simply switch the references to another web reference) easily ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: public function from class in other namespace inaccessible
    ... First off, if you want to use a class to pass data to a web service, you ... A web reference is not the same as a referenced assembly. ... > I added a new class test to the namespace of the webservice which I try to ... > public int TheInt ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Consuming Web Service without Web Reference
    ... Eventhough I extracted schema from WSDL iam not able to call the web service. ... calling a web service than creating an xml and pushing it to the SOAP adapter. ... still have to generate a proxy and configure it in your send port. ... Initially I tried adding the Web reference using the WSDL file. ...
    (microsoft.public.biztalk.general)