0

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 ?

Dolanor
  • 822
  • 9
  • 19
  • How you generate your service? From wsdl or from gsoap service specification? Describe your problem more complex, because i haven't any problem with gsoap before and it works fine for me – Maxim Sep 19 '12 at 13:13
  • I generate it from a header. I guess it must be gsoap service specification like `int ns__pushJob(std::string servicename, std::string data, struct _result_t *res)` – Dolanor Sep 19 '12 at 13:50
  • What do you mean by "I don't have the soap_serve function available"? Did you include the soapH.h header? – Filipe Felisbino Sep 19 '12 at 16:11
  • @filipenf : the `soapcpp2 -i` command generate cpp class *Service.cpp/h and *Proxy.cpp/h. It is those classes that I should include and who provides the `serve()` functions. And I don't know where to modify my classes/gsoap .h declarations so the .serve() handles the HTTP GET. – Dolanor Sep 20 '12 at 10:53

1 Answers1

1

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

Maxim
  • 1,566
  • 10
  • 13
  • `//gsoap ns service namespace: http://feniksa.dnsalias.com/hlanmon.wsdl //gsoap ns service location: http://feniksa.dnsalias.com:8888` shows the problem. You don't make your wsdl available through the gsoap service but through another webserver (apache, lighttp, whatever). if it was available directly through gsoap web server implementing GET, it would be something like : `//gsoap ns service namespace: http://feniksa.dnsalias.com:8888/?wsdl` – Dolanor Sep 20 '12 at 10:46
  • Yep, you are absolutely right. I know, it is good idea to use gsoap http plugin and add ability to download wsdl file directly from application (if it runs as standalone service, not as cgi). But i didn't implemented it yet and i don't support this subproject now. Maybe, if someone wish, i can continue develop "skeleton" application, using gsoap – Maxim Sep 20 '12 at 13:02
  • Ok. As explained, it is the exact need that I have, hosting the wsdl directly on gsoap – Dolanor Sep 20 '12 at 15:07