我在ubuntu服务器10.04工作
我正在创建一个test.h文件,我想包含4个字符串值 .
test.h
int ns__take(string name, string user, string eyes, string result);
//结果将是一个名为user和eyes的strcat //
1 . 没关系?我可以在gsoap Web服务服务器中使用字符串值吗?
2 . 在test.cpp中我可以写 ns__take
方法 result=strcat(name,user,eyes);
吗?
3 . 使用这些字符串值,我如何以编程方式打开文件并在该文件中写入值?每次客户端访问Web服务时,我都希望将输入参数保存在文件中
4. 多个客户端可以同时访问Web服务吗?这会以不好的方式影响我想写输入参数的文件吗?
需要一些帮助!谢谢 . 我是gsoap wsdl web服务的新手 .
编辑:
这是我的test.cpp
#include "soapH.h"
#include "tests.nsmap"
#include <math.h>
main()
{
soap_serve(soap_new());
}
int ns__take(struct soap *soap, std::string a, std::string b, std::string &result)
{
result=a+b;
//
..here i want to add the open file and write the values a,b.
do i need a synchronization if multiple clients acces in the same time the method?
how will that be?
//
return SOAP_OK;
}
我正在使用以下方法编译tests.cgi:
soapcpp2 test.h
> c++ -o tests.cgi test.cpp soapC.cpp soapServer.cpp -lgsoap++
1 回答
是的
不,你做
result=name+user+eyes
或者其他一些,string
,这些都是std::string
类对象就这么做吧
这取决于您如何实施服务 . 是的,如果您并行处理请求,则必须处理同步 .
为什么不在问之前尝试一下?