0

Accessing IIS webservice using Gsoap. I have similar error as in this link shows that the error was solved compiling with -lssl.

I did the same thing in build as

g++ -o client client.cpp stdsoap2.cpp soapC.cpp  soapDataManagementSoapProxy.cpp -I /usr/local/ssl/include -L/home/xavier/GSOAP/lib -lgsoapssl++  -L/usr/local/ssl/lib -lssl

My GSOAP lib was build with OpenSSL.

But I still have error as

SOAP 1.2 fault SOAP-ENV:Sender[no subcode]
"OpenSSL not installed: recompile with -DWITH_OPENSSL"
Detail: [no detail]

My test code is as follow. What could be wrong?

#include "soapDataManagementSoapProxy.h"
#include "DataManagementSoap.nsmap"

const char server[] = "https://XXXXXXX.com/XXXmanagement.asmx";

int main(int argc, char **argv)
{
  DataManagementSoapProxy webinf;
  webinf.soap_endpoint = server;
  _tempuri__ReadTestData* a;
  _tempuri__ReadTestDataResponse res;
  int ret = webinf.ReadTestData(a, res);
  if (webinf.error){
    webinf.soap_stream_fault(std::cerr);    
  }
  else{
    //printf("result = %g\n", result);
    std::cout << "Success " << std::endl;
  }
  webinf.destroy(); /* clean up mem */
  return 0;
}
batuman
  • 7,066
  • 26
  • 107
  • 229

1 Answers1

0

Solution for this issue is

#include "calc.nsmap"
#include "soapcalcProxy.h" // generated with soapcpp2 -j calc.h

calcProxy calc("https-server-endpoint-URL");
double sum;
soap_ssl_init();       // init SSL (just need to do this once in an application)
// soap_ssl_no_init(); // or prevent init OpenSSL when already initialized elsewhere in an application
if (soap_ssl_client_context(calc.soap,
   SOAP_SSL_DEFAULT,
   NULL,          // no keyfile
   NULL,          // no keyfile password
   "cacerts.pem", // trusted certificates (or use self-signed cacert.pem)
   NULL,          // no capath to trusted certificates
   NULL           // no random data to seed randomness
))
{
   calc.soap_stream_fault(std::cerr);
   exit(EXIT_FAILURE);
}
if (calc.add(1.23, 4.56, sum) == SOAP_OK)
batuman
  • 7,066
  • 26
  • 107
  • 229