|
Prev: How do I use msiexec.exe with Visual C++ SP1 Redistributable?
Next: Deleting a file used by another process.
From: Jeov� Almeida on 13 May 2008 22:11 Hello, I'm trying to use a web service from my C++ app. For testing purposes, I created the simple web service in VS2005: [WebMethod] public int Sum(int num1, int num2) { return (num1+num2); } I tested it firstly using asp.net and it worked fine. To make this test, I created a web site in IIS so I could test using http://localhost/webservice/WSTest.asmx Following that, I created a console app, added a web reference to the above URL (which showed my Sum() method) coded: int _tmain(int argc, _TCHAR* argv[]) { if(SUCCEEDED(CoInitialize(NULL))) { WSTest::CWSTest obj; HRESULT hr; int result=0; hr = obj.Sum(3,4,&result); if (SUCCEEDED(hr)) cout << "result = " << result; else cout << "error"; return 0; CoUninitialize(); } The problem is the call to obj.Sum() never succeeds (hr = E_FAIL). When I created the console app, I selected ATL support, but I'm not sure if it's needed. What am I doing wrong? Jeov� |