Calling C# web services using C++/CLR
To a group of people who might want to try to call web service that has written in VB.NET or C# this is how the way of doing it.
Firstly, I am creating a default web service using C# language.
1. Open Visual Web Developer or any edition of Visual Studio 2005.
2. On the File menu, click New Web Site.
The New Web Site dialog box appears.
3. Under Visual Studio installed templates, click ASP.NET Web Service.
4. Click Browse.
5. Click Local IIS.
6. Click Default Web Site.
7. Click Create New Web Application.
Visual Web Developer creates a new IIS Web application.
8. Type the name WebService1.
9. Click Open.
The New Web Site dialog box appears, with the name of the new Web site in the right-most Location list. The location includes the protocol (http://) and location (localhost). This indicates that you are working with a local IIS Web site.
10. In the Language list, click the programming language C#.
11. Click OK.
Visual Web Developer or Visual Studio 2005 creates the new Web service and opens a new class named Service, which is the default Web service. However, in the following procedure you will create a new Web service with a specified name and you will not use the Service class.
After creating the web service you will find a default web method HelloWorld().
Now add a new C++ CLR console project to the solution.
1. Open the File menu, click Add then New Project.
2. Click Visual C++ from the Project types.
3. Click CLR Console Application from Templates.
4. Type ConsoleApplication1 or any name you like to use in the Name: textbox.
Adding the Web Service as a Component
1. In Solution Explorer, right-click the name of the Web site, and then click Add Web Reference.
3. Type in HelloWorld in Web reference name: textbox.
4. Click Add Reference.
Add the following code to your C++ console application.
Now, I will not make the mistake I made again. You will probable realize you do not use
and you use gcnew instead of new keyword.
Expose more and give me feedback. Have fun