May 1, 2010

Template

Please don't mind the template. I still haven't completely fixed everything after having my blog move. My hosting provider futzing with my settings hasn't helped any, given that due to a systems glitch I've been IP blocked for almost a week.

Regardless, things should be completely fixed within the next week or so.

WORKAROUND: Error Adding Web Service In VS2010

Symptom:
When adding a web service reference to a server behind a load balancer (for example, https://url converts to http://url:8081), you encounter an error similar to the following:

---------------------------
Microsoft Visual Studio
---------------------------
Metadata contains a reference that cannot be resolved: 'http://url:8081/WS/WebService.asmx?wsdl'.

There was an error downloading 'http://url:8081/WS/WebService.asmx?wsdl'.

Unable to connect to the remote server

A connection attempt failed because the connected party did not properly respo
---------------------------
OK
---------------------------

Workaround:
First, verify you can get to the WSDL by opening your web browser and pulling the WSDL manually.

If your web service is https://example.com/WebService.asmx, type in https://example.com/WebService.asmx?wsdl.

If you are able to retrieve the WSDL, do the following:

Right-click on your project.
Select "Add Web Reference."
Enter the address of the web service with ?wsdl at the end.
You will get about a dozen popups with this text: "Do you want to view only the webpage content that was delivered securely?" Say "No."
Add the web reference.

Now you have the web reference and the proxy class created, but you won't be able to execute the web service request. Two more steps are required.

Click the "Show all files" button at the top of the solution explorer and expand out your Web References tree. Inside your web reference, you'll find a .WSDL file and a file named "Reference.map."

Open the .wsdl file and find the wsdl:service area. Update the addresses listed there to be the true external name of the web service.

Open the reference.map file and also update the DiscoveryClientResult url field with the same value.

At this point, the web service will function.