Defining the Web Service
At this point, you could use the component with standard COM or COM+ techniques. That's great when you have a local connection, but you may want to make this component available to someone who relies on an Internet connection. Microsoft has made it possible for users of COM+ 1.5 and above to expose a COM+ application as a Web service by making a few small changes to the application setup.
To begin the process, right click the COM+ application entry in the Component Services console—COMPlusTest, in this case—and choose Properties from the context menu. Select the Activation tab, and you'll see an entry for SOAP (like the one shown in Figure 4) when you have COM+ 1.5 or above installed on your system.
To create a Web service, check the Uses SOAP option as shown in Figure 4. Type a name for the Web service. Make sure this name will make sense to anyone accessing the Web application; it's the name that COM+ uses to create the required Internet Information Services (IIS) entry. The example uses MathTest because it's a simple descriptive name. Click OK.
Figure 4: Only COM 1.5 and above users will have the SOAP entry available.
At this point, you could run into a number of errors. The most common error is that you didn't register the component in the GAC. The second most common problem is that you don't have ASP.NET support installed on IIS. The \WINDOWS\Microsoft.NET\Framework\v1.1.4322 folder on your system contains the aspnet_regiis.exe utility that you can use to add ASP.NET support to IIS. This utility runs for several minutes, so don't become concerned about the registration time. Make sure you restart IIS when you finish installing ASP.NET support.
Another common problem is that IIS isn't running. It sounds odd, but IIS isn't always running on some development machines, and you might not notice if you're not working on a Web project at the moment.
When the setup is successful, you can go to a special Web page for the application. For the example, it's http://localhost/MathTest/Default.aspx. This page displays a single link that takes you to the Web Services Description Language (WSDL) for the Web service. For this example, the WSDL appears at:
http://localhost/MathTest/MyMathClass.SimpleMath.soap?WSDL
Keep track of this WSDL URL, because you need it to create a connection from outside applications to your COM+ application disguised as a Web service. This is also the time to check whether COM+ created a good WSDL file. Make sure you look for methods as shown in Figure 5.
Figure 5: The WSDL COM+ creates should show the methods you exported.