Configure URL of web service for different environments

I'm working with a team to convert a classic ASP web application's middle tier over to .NET 1.1. We are only converting the VB6 middle tier code right now. The setup is as follows: ASP page calls VB6 component which calls a .NET component using COM interop. The .NET component acts as a wrapper for the .NET web service (which contains the new business logic). The issue that I have is how do I set the URL of the web service for each environment (dev, test, prod, etc...)

It has been my experience that I can't add an app config to the .NET class library and the VB6 code will not have any app setttings that the .NET class library will be able to retrieve.

Layers:

  1. ASP web app (cannot be modified)
  2. VB6 middle tier (references #3 through COM interop)
  3. .NET class library (acts as a facade to call web service and coverts exceptions to appropriate "err" for VB6)
  4. .NET web service
  5. .NET data layer
  6. Data

Thanks in advance for the help.



Answer this question

Configure URL of web service for different environments

  • FLY_Z66

    Put the URLs for TEST, PROD etc in an XML file.

    Then have your .net class library check what mode it is in, then read from the XML file the URL to use, then set the URL property of your .net proxy object.

    I would create a WebServiceFactory object and give it shared methods to create each webservice proxy object.

    Public Class WebServiceFactory
    Public Shared FUnction GetProxyForWS() As proxyobject.Object
    Dim obj As new proxyobject.Object
    obj.Url = GetUrlForMode(PROD)
    obj.TimeOut = 10000

    Return obj
    End Function
    End Class

  • sqlguru95

    Would there be a way to generate the class using the WSDL tool during the build process I don't want to have to create a factory class for each proxy because there are a few hundred proxies.
  • Configure URL of web service for different environments