I am file with doing manual work up-front to create a dynamic proxy or
whatever.
I have a development web server that talks to a development web
service with development DB, and an anlogous production environment.
Right now, the dev web server has a VS.NET "add web reference" that
points to the dev web service. When development is complete, I can't
just push (xcopy deployment) the files to the production web server
because the web reference will still point to the development server.
So still without knowing precisely what to ask for, I am looking for a
way for the web client to call "any" web service without hardcoding in
Visual Studio, or a config/script-based way to modify what web service
is used at runtime.
Thanks.
>You can do this in theory, as long as the Web service is installed on the
>same domain, but where is the usefulness of this approach? Assuming that you
[quoted text clipped - 19 lines]
>>
>> Thanks.
Scott G. - 06 Aug 2004 20:46 GMT
You can change the change the location of the host with some code on top of the web service calls to do this dynamically (change the Url property of the SoapHttpClientProtocol subclass that represents your proxy). So, off the top of my head:
YourNamespace.FoobarSoap s = new YourNamespace.FoobarSoap();
s.Url = s.Url.Replace("://localhost", "://" + yourNewHostName);
You can also, play around with the rest of the Url if you want.
Take a look at the code Reference.cs (.NET 1.1 that is generated and contains the proxy code).
I wrap all of my webservice client calls in static method that allows me to do this kind of thing, plus setup any authentication that I need (and other stuff like logging, etc...).
Scott
I am file with doing manual work up-front to create a dynamic proxy or
whatever.
I have a development web server that talks to a development web
service with development DB, and an anlogous production environment.
Right now, the dev web server has a VS.NET "add web reference" that
points to the dev web service. When development is complete, I can't
just push (xcopy deployment) the files to the production web server
because the web reference will still point to the development server.
So still without knowing precisely what to ask for, I am looking for a
way for the web client to call "any" web service without hardcoding in
Visual Studio, or a config/script-based way to modify what web service
is used at runtime.
Thanks.
On Mon, 2 Aug 2004 15:22:47 -0700, "Jeffrey Hasan" <jeff@noreply.com>
wrote:
>You can do this in theory, as long as the Web service is installed on the
>same domain, but where is the usefulness of this approach? Assuming that you
>did discover the assembly attributes, what then? You will still need to
>generate SOAP requests to interact with it, and you will have to do this
>manually if you haven't generated a proxy class. And if the Web service is
>installed on a remote server, then you cannot use reflection to discover it.
>Perhaps I am missing the point of your request, so please clarify if I have.
>
>Jeffrey Hasan, MCSD
>President, Bluestone Partners, Inc.
>-----------------------------------------------
>Author of: Expert SOA in C# Using WSE 2.0 (APress, 2004)
>http://www.bluestonepartners.com/soa.aspx
>
>"localhost" <primpilus@cohort.ces> wrote in message
>news:3d8tg09f7u50npqoftctiv5no196c83opt@4ax.com...
>>
>> Looking for a simple concise C# sample that will communicate with a
>> web service without needing WSDL.EXE or VS.NET "create web reference"
>> functionality.
>>
>> Basically I am looking for some code that will at runtime discover
>> what a web service has to offer, kind of like using Reflection to
>> inspect a local .NET dll.
>>
>> Thanks.