Bongo Sharp
Bongo Sharp

Reputation: 9610

How to connect a C++ COM To a WCF Service

I'm looking to a way to connect a COM+ legacy application to a WCF Service, i have been researching this since a couple of days and i haven been lucky to find any useful information, can anyone point me into the right direction on this?

I Need the old COM+ component to make calls to a new C# WCF Service so I Need some kind of proxy in the COM Component that abstracts the communication with the Service.

Thanks in advance, i really appreciate any help.

Upvotes: 1

Views: 1348

Answers (2)

Andy Milligan
Andy Milligan

Reputation: 400

The WCF service moniker can auto-generate a COM proxy for your WCF service. Your C++ code can call this proxy directly without the need for you to write any C# proxy code or explicit COM interop code.

Look at http://msdn.microsoft.com/en-us/library/ms729739(VS.85).aspx for details.

I particularly recommend this feature primarily because I owned the feature at Microsoft.

Upvotes: 0

Mike Atlas
Mike Atlas

Reputation: 8231

I assume you mean that you have a WCF service, and that the code that runs your WCF service needs to make calls to your legacy application and send that data in/out of the WCF service, correct? If that's the case, then the WCF facet of your question is actually irrelevant.

What you're trying to solve is how to get your .NET application to speak COM to your legacy application.

Check out: Introduction to COM Interop and COM Interop Tutorials.

You'll need to generate type libraries for your COM component, reference them and System.Runtime.InteropServices in your C# project, and then you can make your calls across into COM boundaries of your legacy application code. There are a lot of other examples and tutorials out there if you search for COM Interop Tutorial, for example.


EDIT:

I thought more about your problem. You need to implement a proxy by creating a server that "looks" just like your old server (all the same COM+ interfaces etc etc), and then forwards the request (by crafting a new request) to your WCF service. You can do this in C#. I whiteboarded (archive) the basic idea around it from your original whiteboard.

Upvotes: 1

Related Questions