Reputation: 820
I know how to implement the http get for gsoap normal code, but when I generate code with gsoap and soapcpp2 -i
, I don't have the soap_serve function available and I don't know how/where to reimplement the fget/http_get callback
Has anyone tried this ?
Upvotes: 0
Views: 2571
Reputation: 1666
It is hard to understand, what you try to do. I will give small "cookbook" example (C++ version, but C is looks the same), that i wrote some time ago with
a) write correct service interface
$ cat service.h
//gsoap ns service name: mon Simple monitor service
//gsoap ns service encoding: literal
//gsoap ns service namespace: http://feniksa.dnsalias.com/hlanmon.wsdl
//gsoap ns service location: http://feniksa.dnsalias.com:8888
//gsoap ns schema namespace: urn:mon
#import "stlvector.h"
int ns__commandsuccess(std::string secret, int commandid, bool& status);
I created just one simple soap method: commandsuccess
b) generate service classes via soapcpp
soapcpp2 -S -i -2 -I /usr/share/gsoap/import service.h
See soapcpp2 output
gsoap will generate a lot of files. See files: monService.h and monService.cpp (mon is name of service), also see soapH.h
c) implement service function For my example, i add to monService.cpp function
int monService::commandsuccess(std::string secret, int commandid, bool &status)
{
// some logic here
return SOAP_OK;
}
d) find function serve or run. For my service i wrote such code in main.cpp
#include "monService.h"
// other includes here
int main(int argc, char* argv[])
{
// init code
monService service;
// other code here
service.serve(); // <- haha, i am here
// other code
}
See this: https://freeman.svn.sourceforge.net/svnroot/freeman/other/trunk/gsoap
Upvotes: 1