
328Microsoft Visual Studio 2010: A Beginner’s Guide
put http://localhost:8080/WcfDemo.CustomerService.svc into the Address box. In the deployed service, the service name might not be WcfDemo.CustomerService.svc as shown in this demo. To find out what the real service name file should be, navigate to the physical directory where the service was deployed to and use the file name of the *.svc file. Sometimes, you’ll need to use Web services by third parties or another organization in your company. In those cases, you’ll get the address to use from a person in the other organization or read their documentation to learn what address to use. If you add your own address, click Go to get more information on the Web service.
After either clicking Discover or adding an address and clicking Go, you’ll have one or more services in the Services list. At this point, if you receive an error, it will be because the address is incorrect, the service is experiencing an outage, or (in the case of referencing a service in your own project) the service won’t compile. First check the address if you entered it yourself. If you are referencing a project in your solution, go back and recompile the Web Service project to make sure it builds, fix any problems, and try to create the service reference again. Once you’ve ensured that you’ve corrected all the problems on your side of the wire, contact whoever owns the Web service to troubleshoot the problem.
When a Web service can be communicated with successfully, you’ll see the list of services. You can drill down on each service until you find the interface for the service you’re interested in. In Figure
The Web service will create a proxy, which is a class that communicates with the Web service, in your project, using the default namespace declared in the Properties for your project. The namespace in the Add Service Reference defaults to Service1, and you’ll want to change that to something meaningful, such as CustomerService, as shown in Figure
As you can see in Figure