我正在制作服务器端,它将使用gSOAP用c ++编写。我在"Server.h"文件中写了一些简单的"sum"函数。
//gsoap ns service name: Server
//gsoap ns service namespace: urn:Server
//gsoap ns service style: rpc
//gsoap ns service encoding: encoded
int ns__sum(int a, int b, int *res);
然后我使用以下命令 soapcpp2 -i -s C:/Users/pc/Desktop/Server.h 生成了"Server.h",我得到了这些文件:
soapServerService.h
soapServerService.cpp
soapServerProxy.h
soapServerProxy.cpp
Server.nsmap
soapStub.h
soapH.h
soapC.cpp
然后我尝试了以下代码:
#include "Server.nsmap"
#include "soapServerService.h"
int main()
{
ServerService server();
server.serve();
return 0;
}
int ServerService::sum(int a, int b, int *res)
{
*res = a + b;
return SOAP_OK;
}
但我有一些这样的错误:
请求在"服务器"中请求成员"服务",这是非类类型 '服务器服务()
这是什么意思,我必须做什么?
创建服务器服务的对象时,将其创建为服务器服务服务器。您正在将其创建为服务器服务服务器()