This documentation is archived and is not being maintained.

Walkthrough: Representing Indirect Web Service Connections

In Visual Studio Team System Architecture Edition, you can use an ASP.NET Web service application as a façade for the business functions in class libraries. The Distributed System Designers do not support designing or representing class libraries directly on the application diagram. However, you can still represent class library behavior through the ASP.NET Web service application.

To represent a class library on an application diagram

  1. Open the application diagram.

  2. Add a new ASP.NETWebService to the diagram and name it MyWebService. Name the .NET Web service endpoint FirstWebService.

    This creates the Web service that acts as a façade for the class library.

  3. Right-click MyWebService, and click Implement Application.

  4. Add a new ASP.NETWebApplication to the diagram, name it MyWebApplication, and implement it.

    This creates a client Web application that uses the functions in the class library through FirstWebService.

  5. Right-click MyWebApplication and click Settings and Constraints to view the Settings and Constraints Editor.

  6. Expand the Application Settings, Directory, and Configuration nodes.

  7. Right-click the NetSectionGroup node, point to Add Resource, and click SettingsSection.

    After you add this resource, a Web.config file appears in Solution Explorer.

  8. In Solution Explorer, right-click the Solution node, and click New Project.

    The Add New Project dialog box appears.

  9. Under Project types, expand the Visual Basic or Visual C# node, and click Windows. Under Templates, click Class Library, and click OK.

    A class library project appears in Solution Explorer.

  10. Right-click the class library project node, and click Add Web Reference.

    The Add Web Reference dialog box appears.

  11. Click Web services in this solution.

  12. Under Web Services in this Solution, click FirstWebService, and click Add Reference.

    This adds a Web reference for FirstWebService in the class library.

  13. While the class library project remains selected and click Build <class library name> on the Build menu.

    This builds the class library and adds an App.config file to the class library project.

  14. In Solution Explorer, right-click the MyWebApplication project node, and click Add Reference.

    The Add Reference dialog box appears.

  15. Click the Projects tab, click the class library project, and click OK.

    This adds a reference for the class library to MyWebApplication.

  16. Open the Web.config file in the MyWebApplication project.

  17. Open the App.config file in the class library project.

  18. Copy the <configSections> section from App.config and paste it into Web.config. This section looks similar to the following:

    <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
                <section name="ClassLibrary1.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            </sectionGroup>
    </configSections>
    
  19. Copy the <applicationSettings> section from App.config and paste it into Web.config below <configSections>. This section looks similar to the following:

    <applicationSettings>
        <ClassLibrary1.Settings>
            <setting name="ClassLibrary1_localhost_WebService1" serializeAs="String">
    <value>http://localhost:1665/MyWebService/FirstWebService.asmx</value>
            </setting>
        </ClassLibrary1.Settings>
    </applicationSettings>
    

    The beginning of Web.config should now look like this:

    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
        <configSections>
            <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
                <section name="ClassLibrary1.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            </sectionGroup>
        </configSections>
        <appSettings>
        </appSettings>
        <applicationSettings>
            <ClassLibrary1.Settings>
                <setting name="ClassLibrary1_localhost_WebService1" serializeAs="String">
                    <value>http://localhost:1665/MyWebService/FirstWebService.asmx</value>
                </setting>
            </ClassLibrary1.Settings>
        </applicationSettings>
        <connectionStrings/>
        <system.web>
    
  20. Build the solution and then view the application diagram.

    A consumer endpoint appears on MyWebApplication. This consumer endpoint connects to the FirstWebService endpoint on MyWebService. This endpoint represents the connection from the Web reference in the class library project to the Web service.

Show: