2012-01-10 26 views
0

我在ubuntu服务器工作10.04gsoap web服务器 - 接受字符串值的方法?

我正在创建一个test.h文件,我想包含4个字符串值。

test.h 

int ns__take(string name, string user, string eyes, string result); //结果将是用户名和眼睛的strcat的//

。它是确定的?我可以在gsoap web服务服务器中使用字符串值吗?

。在test.cpp里面我可以写ns__take方法result=strcat(name,user,eyes);

。有了这些字符串值,我该如何以编程方式打开文件并在该文件中写入值? 每次客户端访问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++ 

回答

0
  1. 没有,y OU做result=name+user+eyes或一些这样的,string,这些都是std::string类对象
  2. 只要做到这一点
  3. 这取决于你如何实现服务。是的,如果你并行处理请求,你必须照顾同步。
  4. 为什么你不问之前尝试一些东西?
+0

嘿。 thx重播。有用。一切都好,直到第4点。我想问你同步化是什么意思?我发布了目前的test.cpp – 2012-01-10 14:20:45

+0

非常感谢你的努力。我是gsoap,web服务的新手。我正在使用wsdl和tests.cgi。 – 2012-01-10 14:27:31

+0

我认为你的test.cpp并不处理并发请求,所以你不必担心同步。 – 2012-01-10 15:11:02