Appendix B. Microsoft .NET Web services 487
B.2.1 Create a new Web service project
Microsoft Visual Studio .NET 2003 provides a project creator that generates
several important aspects of the Web service being created. For our purposes,
we will be using this software to create a new ASP .NET Web service project.
1. Start Microsoft Visual Studio .NET 2003 by selecting Start → Programs →
Microsoft Visual Studio .NET 2003 → Microsoft Visual Studio .NET 2003.
2. Select File → New → Project.
3. Under Project Types, select the Visual C#® Projects folder. Under
Templates, select ASP.NET Web service.
4. In the Location text box, remove the existing text and replace it with
http://localhost/ManuacturerB, and then click OK:
5. Now the Web service is open but we must select Click here to switch to
code view in order to see the service’s C# code. This can also be done by
right-clicking Service1.asmx in the Solutions Explorer and selecting View
code.
6. Right-click Service1.asmx in the Solutions Explorer frame and Rename the
Web service from Service1.asmx from to ManufacturerB.asmx.
7. Close Microsoft Visual Studio .NET 2003.
B.2.2 Generating a C# file using a WSDL file and wsdl.exe
The next step in creating a Microsoft .NET Web service is to generate a template
Web service source code file based on the XML schemas and operations
described in a WSDL file. For our scenario, we use the Manufacturer.wsdl file
found with the additional materials supplied with this redbook. For instructions on
Important: This implementation was completed using the following software:
Microsoft Windows 2000 Server Edition
Microsoft Visual Studio .NET 2003
Microsoft .NET Framework V1.1
Microsoft Internet Information Services V5.0
Microsoft Certificate Services for Windows 2000 Server
Tip: Ensure that you have started the IIS Admin Service and World Wide
Publishing Service services. The project will not load properly if the Web
server hosting the Web service is in a stopped or suspended state.
Get Patterns: Extended Enterprise SOA and Web Services now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.