Udostępnij za pośrednictwem


How to: Substitute Web Services on Application Diagrams

In Application Designer, you can replace a Web service on an ASP.NET application with another Web service if they are compatible with each other. A compatible Web service provides the same operations and can handle the same messages as the one you want to replace. You can also substitute compatible external Web services for one another as well as BizTalk Web services. For more information, see Overview of Endpoints on Applications.

Note

It is common convention to use the WSDL Binding Name and WSDL Binding Namespace properties to define a specific version of a Web service. Though Application Designer displays a warning when you connect Web service endpoints whose WSDL binding name and binding namespaces do not match, you can still connect those endpoints if the underlying endpoint types are compatible as this is permitted by the underlying ASP.NET infrastructure. One reason for permitting this is because a later version of a Web service, as indicated by a different WSDL binding name or namespace, might still be compatible with an earlier version. However, even if the WSDL binding name and binding namespaces between endpoints match, make sure the substitute Web service is actually compatible.

You can create compatible Web services using several approaches:

  • Copy a Web service provider endpoint to another ASP.NET application, making that copy substitutable for the original.

  • Copy an application with all of its endpoints, making the application substitutable for the original application on all of its endpoints (provider and consumer).

  • Create a custom application prototype with endpoints that have the same defined behavior as the endpoints you want to replace.

    All applications created from the prototype are substitutable with one another. For more information, see How to: Create Custom Prototypes from Configured Applications and Endpoints.

However, these approaches might not create completely compatible Web services, especially if the source includes Web service provider endpoints containing user-defined types that are implemented or created from WSDL files or .disco files. For more information, see Web Service Endpoints Based on WSDL Files. If you want to create substitutes for such endpoints, use the following approaches instead:

  • Create the substitute Web service provider endpoint from the WSDL file associated with an existing Web service provider endpoint that you want to replace.

    This approach makes the substitute endpoint compatible with the source endpoint.

  • On different ASP.NET applications, create substitute Web service provider endpoints from the same WSDL file associated with a single Web service.

    This approach makes each of these endpoints compatible and substitutable with each another.

For more information, see How to: Add Endpoints to Applications

You can also make it possible to substitute compatible Web services by creating Web service consumer endpoints that are associated with the same Web service provider endpoint. You can create such consumer endpoints by copying the same consumer endpoint to consumer applications or by connecting consumer applications to the same Web service provider endpoint. This approach makes each of these consumer endpoints substitutable with one another and also makes it possible to connect them to different but compatible Web service implementations. For more information, see How to: Connect Applications on Application Diagrams.

The following procedures describe two approaches for creating compatible Web services. The first procedure describes how to create a compatible Web service from an unimplemented Web service provider endpoint. The second procedure describes how to create a compatible Web service from an implemented Web service endpoint.

To create a compatible Web service from an unimplemented Web service provider endpoint

  1. On the application diagram, define or choose an existing ASP.NET application as the substitute application.

    Tip

    To define an ASP.NET application, see How to: Define Applications on Application Diagrams.

  2. From the unimplemented source ASP.NET application, copy the Web service provider endpoint that you want to the substitute application.

    A copy of the source endpoint appears on the substitute application. This copy should have the same name, operations interface, WSDL binding name, and WSDL binding namespace as the source endpoint.

  3. Delete the connections that you want to remove from the source endpoint.

  4. Reconnect any disconnected consumer applications to the substitute endpoint.

To create a compatible Web service from an implemented Web service provider endpoint

  1. On the application diagram, make sure that the ASP.NET application with the source Web service provider endpoint is implemented.

  2. Define or choose an existing ASP.NET application as the substitute application.

  3. Select the substitute application, and on the Diagram menu, point to Implementation and choose Create .NET Web Service Endpoint from WSDL.

    The Add Web Reference dialog box appears.

  4. In the Add Web Reference dialog box, click Web services in this solution and then the Web service from which you want to create the substitute Web service.

    Tip

    Instead of searching for Web services in the solution, you can also enter the location of the WSDL file in the URL box of the Add Web Reference dialog box. The source endpoint's WSDL Location property specifies the location of the associated WSDL file.

    A page describing the chosen Web service and its operations appears in the Add Web Reference dialog box.

  5. Click Add Reference.

    A Web service provider endpoint with the same name, operations interface, WSDL binding name, and WSDL binding namespace as the source endpoint appears on the substitute application.

  6. Delete the connections that you want to remove from the source endpoint.

  7. Reconnect any disconnected consumer applications to the substitute endpoint.

See Also

Tasks

Walkthrough: Creating Substitutable Web Services

Other Resources

Defining Applications on Application Diagrams