使用gsoap编译Web服务器客户端时没有重载函数错误

时间:2013-05-16 07:48:29

标签: c++ web-services soap gsoap

我正在尝试在我的本地使用Web服务。我的服务器是用C#和客户端c ++和gsoap编写的。当我尝试编译我的C ++代码时,我收到以下错误:

clientt.cpp
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xlocale(323) : 
warning C4530: C++ exception handler used, but unwind semantics are not
enabled. Specify /EHsc
clientt.cpp(8) : error C2661: 'WebService1SoapProxy::HelloWorld' : no
overloaded function takes 1 arguments

我认为,该函数必须采用1个参数。这有什么问题?

我使用的命令:

wsdl2h.exe -s -o calc.h calc.wsdl 
soapcpp2.exe -i calc.h 
cl client.cpp

.NET Web服务服务器代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace webServiceDnm
{
/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{

    [WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }
}
}

C ++ WEB服务客户端代码:

/* CalcClient.cpp */ 
#include "soapWebService1SoapProxy.h" 
#include "WebService1Soap.nsmap" 
void main() 
{ 
    WebService1SoapProxy service; 
    char* result; 
    if (service.HelloWorld(result) == SOAP_OK) 
        std::cout<< result << std::endl; 
    else 
        service.soap_stream_fault(std::cerr); 
}

0 个答案:

没有答案