views:

542

answers:

0

I'm writing a gSoap client application against a service that has both standard http and https versions. Everything I've written so far works fine with the http service, but when I switch over to the https service, suddenly I'm getting errors.

The only change I made to the code for https support was to add the following on startup:

 soap_ssl_init();   
 if(soap_ssl_client_context(&_tradeService, SOAP_SSL_SKIP_HOST_CHECK, NULL, NULL, NULL, NULL, NULL)) {
     handleError("Failed to set up SSL connection");
     return;
 }

If I have the -DDEBUG flag on, I get an error about certificates: "SSL verify error or warning with certificate at depth 2: self signed certificate in certificate chain" which doesn't cause soap_ssl_client_context to return an error, and I don't think is a huge deal since while I'm testing I don't really care to authenticate the host.

The real issue is this error:

SOAP 1.2 fault: SOAP-ENV:Sender [no subcode] "Unable to handle request without a valid action parameter. Please supply a valid soap action."

which I get when I try and make a request to the service. If I look in the send log that gsoap generates, I see the SoapAction parameter set in the outgoing header. In fact, if I compare the send logs for the http/https services, the only differences is that the urls for the secure service are prefixed by https.

I then thought maybe something is messed up with the server, so I used curl to send the exact same XML data that gsoap logged it sent, with the exact same headers. This works fine, I see a normal response with the data I expect. This leads me to believe maybe I am setting up SSL incorrectly?

The other issue I had that was not in the docs, was that when I built with the -DWITH_OPENSSL -lgsoapssl++ -lssl -lcrypto flags I was still getting linker errors about gsoap's ssl methods. I had to include stdsoap2_ssl_cpp.cpp in my build in order to get these resolved, which I thought was odd.

Anybody tried doing this before that can give me some pointers?