Share via


Web References and Custom Web Service Client Proxy Classes in Class Libraries

In Application Designer, you can represent Web references to Web services or custom Web service client proxy classes that are defined in referenced projects or assemblies as Web service consumer endpoints on Windows, Office, or ASP.NET applications. To accomplish this task, you must take certain steps to display these elements as "indirect" types of and connections to Web service consumer endpoints.

Note

You cannot directly add Web service consumer endpoints to represent these elements by connecting the consumer application to a Web service provider endpoint and moving these elements into a class library.

However, before taking these steps, the Web service consumer application must be implemented, and the application project must contain an application configuration file (Web.config or App.config). For more information, see Implementing Applications on Application Diagrams.

Requirements for Reverse-Engineering Web References and Custom Web Service Client Proxy Classes in Class Libraries

For ASP.NET applications, you must add the appropriate entries to the Web.config configuration file, and proxy classes with matching and fully qualified names must exist and be found. However, for Windows and Office applications, the existence of such entries in the App.config configuration file and their designation as WebServiceURL type is sufficient. However, if these entries are not designated with WebServiceURL type, or if they are designated with String type, then proxy classes with matching and fully qualified names must also exist and be found. For more information, see Considerations for Custom Web Service Client Proxy Classes.

When a Web service consumer application references class libraries that define Web references or custom Web service client proxy classes, a project reference to that class library must be added to the Web service consumer application project. However, the settings in the application project's configuration file override those in the class library configuration file. Therefore, in order to use the settings created in the class library configuration file, you must copy them to the consumer application's configuration file. For more information, see How to: Reference Class Libraries from Applications on Application Diagrams.

When these requirements are fulfilled, Application Designer reverse-engineers these configuration file entries as Web service consumer endpoints. In addition, if the Web service URLs specified in these entries match the URLs of existing Web service provider endpoints, connections between these consumer and provider endpoints also appear. If no matching Web service provider endpoint exists, but the URL can be used to locate a valid WSDL file for the Web service by appending "?wsdl" or "?disco" to the URL, then an external Web service is added to the application diagram and is connected to the Web service consumer endpoint. If a WSDL file cannot be located using the URL, the Web service consumer endpoint remains unconnected.

Changes Affecting Indirect Web Service Consumer Endpoints

Making certain changes affect indirect Web service consumer endpoints and their connections in the following ways:

  • Creating or deleting connections to indirect Web service consumer endpoints from the application diagram adds or removes the URL of the connected Web service from the consumer application's configuration file.

  • Deleting indirect Web service consumer endpoints from the application diagram deletes the corresponding configuration file entries but not the Web references or custom proxy classes from the class libraries.

    Note

     If you delete an indirect endpoint, make sure that the application or any referenced class libraries no longer reference the corresponding configuration file entry.

  • Deleting or renaming a proxy class in a project or assembly referenced by an ASP.NET application removes the corresponding Web service consumer endpoint.

    This result occurs because the configuration file entry no longer matches a proxy class. Adding back a proxy class with a matching name causes the consumer endpoint to reappear.

  • Copying and pasting Web service consumer endpoints whose Web references reside in a class library or assembly causes Web references for the pasted endpoints to appear in the root project.

See Also

Reference

Considerations for Custom Web Service Client Proxy Classes

Other Resources

Referencing Class Libraries from Applications on Application Diagrams