Unsolved How to make server using gSOAP?
-
I'm making server side which will be written in c++ using gSOAP. I wrote some simple "sum" function in "Server.h" file.
//gsoap ns service name: Server
//gsoap ns service namespace: urn:Server
//gsoap ns service style: rpc
//gsoap ns service encoding: encodedint ns__sum(int a, int b, int *res);
Then I generated "Server.h" using this command soapcpp2 -i -s C:/Users/pc/Desktop/Server.h and I got these files:soapServerService.h
soapServerService.cpp
soapServerProxy.h
soapServerProxy.cpp
Server.nsmap
soapStub.h
soapH.h
soapC.cpp
Then I tried this code:#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;
}my program is crashed after execute, I know that I have to write server = new ServerService() but when I write like this, I have another error
-
This has nothing to do with Qt. You're more likely to get help on some forum or mailing list of gSOAP users.
You may get a bit more luck here with KD Soap.
When it comes to the technology in general, I'd strongly recommend (if possible) to switch to JSON. Much simpler, much easier.
-
@sierdzio Firs of all thank you for your advise but I want to use only gSOAP, Also I agree with you that this has nothing to do with Qt, although I want to write this program in Qt but I can not write even in native c++ yet.
-
@L.Gogs If you can't write it without Qt then you should really ask on the gSOAP mailing list. Why do you think Qt forum is the right place to ask about gSOAP? If you're lucky somebody reading here will be able to help you but it is much more likely to get help in the right place...
-
@L.Gogs said in How to make server using gSOAP?:
ServerService *server;
server->serve();I know you say you know you have to new it so
even its 100% sure it crashes
at server->serve();But what is then the question ?
-
@L.Gogs "but when I write like this, I have another error" - don't you think it could help others to help you if you would actually say what error it is? "another error" can mean anything...
-
@sierdzio said in How to make server using gSOAP?:
When it comes to the technology in general, I'd strongly recommend (if possible) to switch to JSON. Much simpler, much easier.
Can you write examples how to do Json server?
-
@Taz742 What is "Json server"?
-
@jsulm sorry.
We need a web server? -
@Taz742 I still don't understand: if you need a web server install one? How is it related to JSON + Qt? What exactly is the question?
-
@jsulm said in How to make server using gSOAP?:
How is it related to JSON + Qt?
Yes, I'm interested in it.
-
@Taz742 Start here http://doc.qt.io/qt-5/json.html
-
@jsulm Where to continue reading?
-
@Taz742 There are links to an example and to all the JSON related classes...