2012-01-10 46 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