Search code examples
c++web-servicesgsoap

Compilation error with GSOAP c++


I am trying to follow the GSOAP documentation to create a server - client webservice in c++.

Here is a part of the code of my server :

int main()
{
    return soap_serve(soap_new()); // use the service operation request dispatcher 
}
// Implementation of the "add" service operation: 
int ns__add(struct soap *soap)
{
    return SOAP_OK;
}

struct Namespace namespaces[] =
{   // {"ns-prefix", "ns-name"} 
    { "SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/" },
    { "SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/" },
    { "xsi", "http://www.w3.org/2001/XMLSchema-instance" },
    { "xsd", "http://www.w3.org/2001/XMLSchema" },
    { "ns", "urn:simple-calc" }, // bind "ns" namespace prefix 
    { NULL, NULL }
};

And here is my client :

#include "soapServiceProxy.h"
#include "Service.nsmap"
int main(void)
{
ServiceProxy service;
double result;

if (service.add(1.0,2.0,result) == SOAP_OK) // Here is the error
    std::cout << "The sum of 1.0 and 2.0 is " << result << std::endl;
else
    service.soap_stream_fault(std::cerr);

service.destroy(); // delete data and release memory

return 0;

}

I have followed all the differents steps with wsdl2h qnd soapcpp2 however I have a compilation error on service.add that said that non function matches the argument list.

Error : "none instance of the overladed function "ServiceProxy::add" natches the arguments list Types are (double,double,double)"

Do someone understand why?


Solution

  • You have defined a function that takes no arguments like (double, double, double). Instead it takes only soap struct. You are calling function with wrong parameters or you haven't defined it. It can be seen in you wsdl or header file.