Gsoap
Jump to navigation
Jump to search
Client call
Vademecum
PS: the compile order is important
C
sudo apt-get install gsoap mkdir tmp && cd tmp mkdir gsoap wsdl2h -c -o gsoap/calc.h http://www.genivia.com/calc.wsdl soapcpp2 -c -C -d gsoap gsoap/calc.h cat > main.c <<EOF #include "gsoap/soapH.h" #include "gsoap/calc.nsmap" main() { struct soap *soap = soap_new(); double result; if (soap_call_ns2__add(soap, 0, 0, 1.0, 2.0, &result) == SOAP_OK) printf("The sum of 1.0 and 2.0 is %lg\n", result); else soap_print_fault(soap, stderr); soap_end(soap); soap_free(soap); } EOF gcc -g -o client gsoap/soapC.c gsoap/soapClient.c main.c -l gsoap ./client
C++
sudo apt-get install gsoap mkdir tmp && cd tmp mkdir gsoap wsdl2h -s -o gsoap/calc.h http://www.genivia.com/calc.wsdl soapcpp2 -i -C -d gsoap gsoap/calc.h cat > main.cpp <<EOF #include "gsoap/soapcalcProxy.h" #include "gsoap/calc.nsmap" main() { calcProxy service; double result; if (service.div(1.0, 0, result) == SOAP_OK) std::cout << "The sum of 1.0 and 2.0 is " << result << std::endl; else std::cerr << service.soap_fault_string() << std::endl; } EOF g++ -g -o client main.cpp gsoap/soapcalcProxy.cpp gsoap/soapC.cpp -l gsoap++ ./client