| Standards for Technology in Automotive Retail |
| Home - News Feed

5.4. .NET Walkthrough
Prev | Chapter 5. .NET Examples | Next

## 5.4. .NET Walkthrough

### 5.4.1. .NET Service

Procedure 5.1. Generating Web Service Class code from STAR WSDL

1. Retrieve WSDL from Star Schema Repository and extract the StarTransport_2005.wsdl file.

   Figure 5.1. WSDL Extract

2. Open Visual Studio 2003 command prompt.

   Figure 5.2. Visual Studio 2003 Command Prompt

3. Run wsdl.exe against the extracted WSDL file. By default WSDL generated codes are generated in C# language. You can optionally specify the target language to ‘VB’ (Visual Basic) by using the /language parameter. Make sure to execute this command where you have extracted the STAR WSDL.

       wsdl startransport_2005.wsdl /language:VB

Procedure 5.2. Creating the ASP.Net Web Service

1. Open up the Visual Studio .Net 2003 and create a new ASP.Net Web Service Project.

   Figure 5.3. Create ASP.NET Web Service

2. Rename the Service1.asmx file to StarWebService.asmx.

   Figure 5.4. Rename Service1.asmx

3. Copy contents of generated GenericWebService.vb to the code behind of your new web service page.

4. Rename the Class name to StarWebService

   Figure 5.5. Rename StarWebService

5. Set the URL in the class constructor to the actual URL of the web service.

   Figure 5.6. Set URL for Web Service

6. Add a WebMethod attribute for each of the STAR WebMethods.

   Figure 5.7. Add Web Method to ProcessMessage

   Figure 5.8. Add Web Method to Pull Message

   Figure 5.9. Add Web Method to Put Message

7. Replace the ProcessMessage function’s code with the following line:

   Figure 5.10. Update Process Message

8. Insert the following function anywhere inside the class code.

   Figure 5.11. Add Playload Response

9. Modify the ASMX file to refence the StarWebService Class.

   Figure 5.12. Modify ASMX Web Service

10. Compile the code and run. You should now have a web service that has all three STAR Methods.

    Figure 5.13. Deployed Web Service

### 5.4.2. .NET Client

In this section, we will be creating a windows form application that calls the Web Service’s ProcessMessage method.

Procedure 5.3. Creating Web Service Client

1. Create a new windows application project.

   Figure 5.14. Create .NET Client

2. Create a Windows form that has the following layout:

   Figure 5.15. Create Windows Form

3. Add a web reference to the star web service you’ve previously created.

   Figure 5.16. Add Web Reference

4. Create a function that would process the request BOD.

   Figure 5.17. Create Function Process Request

5. Recompile the Client Code.

Procedure 5.4. Running the Client and Web Service Code

1. Run the windows application code and copy any STAR BOD examples from the Repository's example folder to the Input BOD text box.

   Figure 5.18. Copy sample BOD

2. Click on the Submit button and examine the output BOD and Content IDs in the Diagnostic Textbox.

   Figure 5.19. Client Results

Prev | Up | Next
5.3. Prerequisites | Home | Chapter 6. Java Examples