Qt/gSoap

How to use gSoap with Qt. Or any other transport you would like to use. The gSoap documentation, allthough containing many words, is somewhat scarce in usefull information.

To use a different transport than the internal in gSoap,  you can set the is and os to your own std::stringstream.

Short example:

Run soapcpp2 with -i to generate proxies an object inherited from soap struct.

Then create a class that inherits the 


#include <QByteArray>
#include <sstream>

#include ".gsoap/soapExampleService.h"

class ExampleServiceWrapper:public ExampleService{

public:
    ExampleServiceWrapper(int imode=SOAP_IO_BUFFER, int omode=SOAP_ENC_XML){
                is = &_is;
                os = &_os;
    }
    virtual ~ExampleServiceWrapper();

    void setRequest(QByteArray ba){
        _is << ba.data();
    }

    QByteArray response(){
        return QByteArray(_os.str().data());
    }
private:
    std::stringstream _is;
    std::stringstream _os;
};


Sign in  |  Recent Site Activity  |  Terms  |  Report Abuse  |  Print page  |  Powered by Google Sites