c++windowsssl-certificateclient-certificatesgsoap

gsoap Reading CA file, Windows


I am trying to consume a webservice that I created and deployed in tomcat, enabling ssl in this latter.

For creating the client code, I use gsoap. I generated nedded files, and below my code in C++ :

soap_ssl_init();    
soap_init(&soap);   


      if (soap_ssl_client_context(&soap,
            SOAP_SSL_DEFAULT,   /* use SOAP_SSL_DEFAULT in production code */
            NULL,       /* keyfile: required only when client must authenticate to server (see SSL docs on how to obtain this file) */
            NULL,       /* password to read the keyfile */
            "cacert.pem",       /* optional cacert file to store trusted certificates */
            NULL,       /* optional capath to directory with trusted certificates */
            NULL        /* if randfile!=NULL: use a file with random data to seed randomness */ 
            ))
        { 
            soap_print_fault(&soap, stderr);
            exit(1);
        }

        if(soap_call___ns2__Add(&soap,"https://localhost:8443/TestWebService/services/AddService.AddServiceHttpsSoap11Endpoint", NULL,&add, &resp)!= 0)
             soap_print_fault(&soap, stderr);

When I execute the program, I got this meesage :

Error 30 fault: SOAP-ENV:Server [no subcode] "SSL error" Detail: Can't read CA file and directory

As I read, I thinh that I have to generate some files (.pem, certs...).

It's the first time that I use goap and ssl, How could I solve this issue?

I use Windows (coz all examples that I found are for linux)


Solution

  • The problem was not related to my C++ Client code. Infact, I had to add the server certification file to the Bin\security\cacerts file located into my jre.

    I had to try to implement a Java client to understand the problem.