To generate a proxy for a web services (within Visual Studio) that is not referenced using traditional Web References. follow these steps:
- Right click on the Proxy project and select Add Web Reference.
- Enter the URI of the web service you are trying to access and click Add Reference. This will create a Web References Folder and a localhost node in the tree.
- Click the Show All Files icon from above in Solution Explorer. This will allow you to drill-down into the localhost reference by clicking the +.
- Expand both localhost and Reference.map and you will see the Reference.cs file. This is the generated proxy.
- Copy the code from in the Reference.cs file.
- Add a new class to the Proxy project and paste the code copied from Reference.cs into the new class. Ensure that the name of your newly created .cs file matches the name of the class you are pasting in.
- Delete the localhost node in the Web Reference folder.
- Delete the Web References folder.
- Tidy up the pasted proxy class.
- Correct the namespace to be the same as your proxy project’s default namespace.
- Add an entry into the Settings.settings file with the URI of the new service (add a Settings File to your project if you don’t currently have one).
- there will be one or more places there the generated code states "this.Url = global::", change this reference to this.Url = global::<ProjectName>.Settings.Default.<Entry name you created in the settings file>.