Innkeeper
Innkeeper

Reputation: 673

gSoap example is not compiling

I am trying to build my first gSoap application. Even the calc example given wouldn't compile for me. I followed the readme file, and did the following:

  1. converted the wsdl to a header with the provided tool (wsdl2h -s -o calc.h http://www.cs.fsu.edu/~engelen/calc.wsdl)

  2. Used soapcpp2 with the generated calc.h (soapcpp2 -i calc.h)

  3. Created a new project, added a "soap" directory, and copied the following files there: calc.nsmap, soapC.cpp, soapcalcProxy.h, soapH.h, soapStub.h, stdsoap2.h, stdsoap2.cpp

  4. Wrote this piece of code:

    #include "soap/soapcalcProxy.h"
    #include "soap/calc.nsmap"
    
    int main()
    {
        calcProxy service;
        double result;
        if (service.add(1.0, 2.0, result) == SOAP_OK)
            std::cout << "The sum is " << result << std::endl;
        else
            service.soap_stream_fault(std::cerr);
    }
    
  5. Tried to compile

    make all 
    Building file: ../soap/soapC.cpp
    Invoking: GCC C++ Compiler
    g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"soap/soapC.d" -MT"soap/soapC.d" -o "soap/soapC.o" "../soap/soapC.cpp"
    ../soap/soapC.cpp: In function ‘int soap_out_SOAP_ENV__Reason(soap*, const char*, int, const SOAP_ENV__Reason*, const char*)’:
    ../soap/soapC.cpp:914:48: error: too many arguments to function ‘int soap_set_attr(soap*, const char*, const char*)’
    ../soap/stdsoap2.h:2384:27: note: declared here
    make: *** [soap/soapC.o] Error 1
    

It complains about wrong number of arguments in a generated file. What am I doing wrong?

Upvotes: 0

Views: 3080

Answers (1)

mpromonet
mpromonet

Reputation: 11942

Your are mixing 2 differents release of gSOAP :
1. the code generator soapcpp2
2. the include file soap/stdsoap2.h (it's not a generated file but an part of gSOAP)

If you installed gsoap as a package, the include file should be in /usr/include. Otherwise you should add "-I [gSOAP include]" to the compile command and "-L [gSOAP lib]" to the link command.

I was able to build your main.cpp with the following commands

 mkdir soap
 wsdl2h -s -o soap/calc.h http://www.cs.fsu.edu/~engelen/calc.wsdl
 soapcpp2 -i soap/calc.h -d soap
 g++ -o calc main.cpp soap/soapC.cpp soap/soapcalcProxy.cpp -lgsoap++

Upvotes: 4

Related Questions