COM Integration


COM+ Integration

The Windows Communication Foundation provides a rich environment for creating distributed applications. If you have a substantial investment in component-based application logic hosted in COM+, you can use WCF to extend your existing logic rather than having to rewrite it. A common scenario is when you want to expose existing COM+ or Enterprise Services business logic through Web services.

When an interface on a COM+ component is exposed as a Web service, the specification and contract of those services are determined by an automatic mapping to be performed at application initialization time. The conceptual model for this mapping is as follows:

  • There is one service for each exposed COM class.

  • The contract for the service is derived directly from the selected component's interface definition.

  • The operations in that contract are derived directly from the methods on the component's interface definition.

  • The parameters for those operations are derived directly from the COM interoperability type corresponding to the component's method parameters.

  • Default addresses and transport bindings for the service are provided in a service configuration file, but those can be reconfigured as required.

Note

The contracts for the generated WCF services are tied to the underlying COM+ application's interfaces and configuration.

Modifying the COM+ component methods automatically results in an updated service when the application is next started. However, a modification to the number of interfaces does not automatically update the available services. In the latter scenario you will need to rerun the COM+ Service Model Configuration tool (ComSvcConfig.exe).


The authentication and authorization requirements of the COM+ application and its components continue to be enforced when used as a Web service. If the caller initiates a Web service transaction, components marked as transactional enlist within that transaction scope.

The steps that are required to expose a COM+ component's interface as a Web service without modifying the component are as listed here:

1.

Determine whether the COM+ component's interface can be exposed as a Web service.

2.

Select an appropriate hosting mode.

3.

Use the COM+ Service Model Configuration tool (ComSvcConfig.exe) to add a Web service for the interface.

Supported Interfaces

There are some restrictions on the type of interfaces that can be exposed as a Web service. Here's the list of restricted interface types:

  • Interfaces that accept object references as parameters

  • Interfaces that accept types that are not compatible with the .NET Framework COM Interop conversions

  • Interfaces for applications that have application pooling enabled when hosted by COM+

  • Interfaces of components that are marked as "private" to the application

  • COM+ infrastructure interfaces

  • Interfaces from the system application

  • Interfaces from managed components that have not been added to the Global Assembly Cache

Selecting the Hosting Mode

As is stated in the documentation, COM+ can expose Web services in one of the following three hosting modes.

COM+-Hosted

The Web service is hosted within the application's dedicated COM+ server process (Dllhost.exe). This mode requires the application to be explicitly started before it can receive Web service requests. The COM+ options Run as an NT Service or Leave Running When Idle can be used to prevent idle shutdown of the application and its services. This mode has the benefit that it provides both Web service and DCOM access to the server application.

Web-Hosted

The Web service is hosted within a Web server worker process. This mode does not require the COM+ application to be active when the initial request is received. If the application is not active when this request is received, it is automatically activated before the request is processed. This mode also provides both Web service and DCOM access to the server application, but it incurs a process hop for Web service requests. This typically requires the client to enable impersonation. In WCF, this can be done with the SetSspiSettings method and the Impersonation enumeration value.

Note

Like other WCF services, the security settings for the exposed service are administered through roles and web host settings. COM+ application roles are enforced, whereas traditional DCOM security settings such as the DCOM machine-wide permissions settings are not.


Web-Hosted In-Process

The Web service and the COM+ application logic are hosted within the Web server worker process. This provides automatic activation of the web hosted mode, without incurring the process hop for Web service requests. The disadvantage is that the server application cannot be accessed through DCOM.




Presenting Microsoft Communication Foundation. Hands-on.
Microsoft Windows Communication Foundation: Hands-on
ISBN: 0672328771
EAN: 2147483647
Year: 2006
Pages: 132

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net