C++/CLI and WSE3

WSE3 brings some very welcomed upgrades to WSE, including MTOM and WS-Security 1.1 support to the .NET Framework v2.0. For those of you interested in this, you might want to know that most of WSE3 (at least all the features I've personally tried) works just fine with C++/CLI, though you won't find much samples or documentation on this.

However, the support in WSE3 for this is pretty much non-existant. Be aware that the WSE Settings Wizards/Add-Ins in Visual Studio 2005 do not work for C++/CLI projects (neither service nor client). Also, WseWsdl3.exe doesn't really support C++/CLI either. If you use it to generate a WSE proxy for a regular WebService (with the /type:WebClient and /language:CPP options), it won't fail, but it will only generate a regular SoapHttpClientProtocol-derived proxy class, and won't generate the WebServiceClientProtocol-derived one, like it does for C# and VB.NET. In other words, if you specify /language:CPP, WseWsdl3.exe will simply invoke wsdl.exe underneath.

If you're comfortable writing WSE code directly and creating policy and configuration files by hand, though, you can make full use of the functionality in WSE both for clients and services created with C++/CLI. Normally you'll just use wsdl.exe or the regular Add Web Reference wizard (which does work on C++/CLI projects, btw) and then modify the generated code by hand to add WSE support to it.

This kind of thing, I believe, is one of the significant hurdles that cause C++ developers pain when trying C++/CLI. The Visual C++ team put a huge effort in creating the new language and supporting it in Visual Studio 2005. While it's not perfect, it is certainly orders of magnitude better than the old MC++ syntax. However, C++ developers adopting it can find themselves in a bit of trouble because many other teams in Microsoft working on frameworks and libraries for .NET explicitly decide not to support C++ as a working language (this happens both inside the .NET/DevDiv teams as well as outside). I certainly hope this improves in the future, though I'm not very hopeful on the matter.


Tomas Restrepo

Software developer located in Colombia.