Got another issue today. When a developer using VS.Net in another part of our organization calls our webservice the user gets a fun:
Unable to download following files from .
http://urlofwebservice
Do you want to skip these files and continue?
Yes No
Reproduction:
The developer who is trying to resolve this issue needs access to another webserver.
- RDP into the webserver that is your test environment
- Copy the code (asmx, bin, config, wsdl, xsds, etc) in http://urlofwebservice
/TestVD/ to a new directory called TestVD2. - Create a new virtual directory called TestVD2 pointing to the new directory
- Now from your local machine in your vs.net project add a web reference to the http://urlOfWebservice/TestVDTest/WebService.asmx
- You'll get the error as stated above now. For some reason it can't resolve the wsdl.
Research:
First I did a search on how the WebService.asmx?wsdl page is created as it is not something we can see at design time. Found a blurb that said that this page is created using reflection at runtime based off the WebService.asmx page.
Resolution:
To resolve this issue:
- Open up the Webservice.asmx.cs page
- Change the WebServiceBinding at the top from:
- Recompile
- Publish to a directory
- Copy new bin and asmx page out to test server in both the TestVD and TestVDTest.
- Follow steps in the reproduction section above to verify it picks up the wsdl and xsd's if you have'em.
[WebServiceBinding("WebService1", "http://someurl/WSDL/WebService/v1_0_1", "http://localhost/TestVD/WebService.wsdl")]
to
[WebServiceBinding("WebService1", "http://someurl/WSDL/WebService/v1_0_1", "http://urlofwebservice/TestVD/WebService.wsdl")]
Kinda weird here as the test we'll do later will be to TestVDTest which will have code that points to the wsdl on TestVD.
Voila! You should be good now. The reflection of the asmx page picks up the localhost entry. Then when other developers out there don't have the locahost/TestVD directory the wsdl doesn't resolve. Change the localhost url to a url that others can resolve to and that fixes the problem.