Rahul Singla

I am developing a web-service which I might distribute to multiple clients who will use it on a private LAN. I am using a DomainName registered in my name as the Namespace for the service, so that is guaranteed to be unique.

But the problem is that I dont know the server name on which the client will deploy the web-service. That is to say, the service URL would be something like:
http://hostname/Services/myservice.asmx

Although I would not like to embed the path /Services into the proxy that I will generate, but I can do it, if there's no other way out. But I would never know the hostname which would host the service. Morover, if I know it, I will have to generate multiple proxies for multiple clients, & regenerate them, if some client changes the host.

A application that needs to contact this service would always have the hostname at runtime. So, is there a way I make make the proxy class accept this hostname (& preferably the path to the service also) at run-time


Re: ASMX Web Services and XML Serialization Specifying a WebService host at run-time

John Saunders

Yes. You can set the Url property of your proxy instance.






Re: ASMX Web Services and XML Serialization Specifying a WebService host at run-time

Rahul Singla

But in a resource on web-services, I read that after you generate a web-service proxy using WSDL.exe, any change in the URL of the service would need the proxy to be regenerated!!!

Also, if I do not update my service often, is it still preferable to add a web reference to it in my client app, instead of generating it with WSDL.exe. I ask this because aint the extra files generated by adding web-reference impact the performance of the service method call at runtime, however negligible that impact might be!!!




Re: ASMX Web Services and XML Serialization Specifying a WebService host at run-time

John Saunders

You do not have to regenerate your proxy when you change the Url property.

Adding a web reference generates the same proxy classes that WSDL.EXE does. Add Web Reference also generates a few other files, but thay have no impact on performance if you don't use them.






Re: ASMX Web Services and XML Serialization Specifying a WebService host at run-time

Rahul Singla

Thanx!!
You said they have no impact if I dont use them. Well, what I knew was they were used only for keeping the proxy class up-to-date in case of a modification in the web-service.

Is that true, or the files have other uses also




Re: ASMX Web Services and XML Serialization Specifying a WebService host at run-time

John Saunders

I'm not sure which files you're referring to. I was referring to the .datasource file that Visual Studio 2005 now produces.

The proxy class is only updated if you use "Update Web Reference". It doesn't update without your explicit action.






Re: ASMX Web Services and XML Serialization Specifying a WebService host at run-time

Rahul Singla

I was referring to the .disco, .discomap & .wsdl files.




Re: ASMX Web Services and XML Serialization Specifying a WebService host at run-time

John Saunders

The files you mention are not used at runtime.

The only time that the proxy classes are generated is when you use "Add Web Reference" or "Update Web Reference". They do not get updated when you do a build.






Re: ASMX Web Services and XML Serialization Specifying a WebService host at run-time

Rahul Singla

You said that .datasource file is generated now. But I have .disco files etc. being generated.
Is it that the newer versions of VS2005 have switched the files that are generated

Moreover, what are all these files used for if they are not used at runtime




Re: ASMX Web Services and XML Serialization Specifying a WebService host at run-time

John Saunders

There is more than one way to locate a web service. I believe that the .disco file (and maybe .discomap) is used when the web service is located using UDDI.

This has no effect at runtime. Visual Studio uses those files in the process of locating the service and in generating the proxy. They are not used by .NET at all.

If you want to learn what is used at runtime, look at the code generated for your proxy classes. They don't refer to files at all. Furthermore, if you look to see which files are deployed when you publish the web service, you will find that these extra files are not deployed. This suggests that they are not needed at run-time.






Re: ASMX Web Services and XML Serialization Specifying a WebService host at run-time

Rahul Singla

Thanx!!!