1

I am using gsoap for calling a wcf webservice. My requirement say I must use ssl protocol to secure communication. I read an article as my reference for ssl configuration.

But in compiling I get following error:

Error 1 error LNK2019: unresolved external symbol _soap_ssl_init referenced in function "public: int __thiscall LogServicesFacade::SendFileToServer(char const *)" (?SendFileToServer@LogServicesFacade@@QAEHPBD@Z) E:\Path\To\My\Solution.Project\LogServicesFacade.obj Solution.Project

Here is my code:

_ns1__StoreEventFileResponse response;
_ns1__StoreEventFile input;
struct soap *soap = soap_new();

/*if (!sslInitiated)
{*/
    soap_ssl_init();
    //if (soap_ssl_client_context(soap, SOAP_SSL_DEFAULT, NULL, NULL,
        //"C:\\Path\\To\\Certs\\File\\cacerts.pem", NULL, NULL))
    //{
        soap_print_fault(soap, stderr);
    //}
//}

I comment some another ssl function to reducing errors for simplicity.

Update 1

It is worth to mention that I use VS 2013. So I use Visual C++ as my compiler. Also I saw gSOAP ssl document. The author said I must add Option DWITH_OPENSSL to compiler. How I can add this to VC compiler?

Seyed Morteza Mousavi
  • 6,855
  • 8
  • 43
  • 69
  • Do you link with the library that contains the function? – Some programmer dude Sep 18 '15 at 06:42
  • I am new to c++. How I can find library of this function so I can link to that? – Seyed Morteza Mousavi Sep 18 '15 at 06:43
  • 1
    And regarding `DWITH_OPENSSL`, I'm sure that the author actually said `-DWITH_OPENSSL`, where `-D` is the common preprocessor flag (used by e.g. GCC and Clang) to defined a macro, which means it defines the macro `WITH_OPENSSL`. You can add that in the project settings preprocessor tab. – Some programmer dude Sep 18 '15 at 06:44
  • @JoachimPileborg a user at http://stackoverflow.com/questions/6316007/how-to-use-ssl-in-c-gsoap-generated-classes said that i use file name 'ligsoapssl++.a'. I didn't a file this name in root of gsoap directory. – Seyed Morteza Mousavi Sep 18 '15 at 06:52
  • Files starting with `lib` and ending in `.a` is a static library in POSIX environments (like Linux or Mac OSX). Your library should be named *something* like `gsoapssl++.lib`. – Some programmer dude Sep 18 '15 at 06:55
  • @JoachimPileborg thanks for your help. http://www.codeproject.com/Articles/30497/Creating-a-gSoap-eBay-Client-Application-with-Visu said how to link to gsoap. – Seyed Morteza Mousavi Sep 18 '15 at 07:08

1 Answers1

1

As in code project article said, I mitigated errors using following steps:

  • Right click on the project and select Properties from the right click menu. Under Configuration Properties, C/C++ and General, add include paths to gSOAP and Open SSL. Click Apply.

  • Under Configuration Properties, C/C++ and Preprocessor, add “WITH_OPENSSL” (to enable SSL in gSOAP) and “DEBUG” (to enable logging) to the list of Preprocessor Definitions. Click Apply.

  • Under Configuration Properties, Linker and General, add the path to the Open SSL binary directory, where the compiled lib files reside, to Additional Library Directories. Click Apply.

  • Under Configuration Properties, Linker and Input, add “libeay32.lib” and “ssleay32.lib” to Additional Dependencies. These
    are the Open SSL libraries. Click Apply.
Seyed Morteza Mousavi
  • 6,855
  • 8
  • 43
  • 69