2017年2月23日 星期四

Rebuild wsdl2h with SSL/TLS enabled.

If you want to translates HTTPS's WSDL and XSD files to a gSOAP header file by wsdl2h.exe. You will get below error because wsdl2h.exe is not support SSL/TLS.

Cannot connect to https site: SSL/TLS support not enabled, please rebuild wsdl2h with SSL/TLS enabled using 'make secure' or download the WSDL/WADL and XSD files and rerun wsdl2h on these files directly by specifying the file names on the c ommand line.



To enable SSL/TLS, you can rebuilt wsdl2h.exe using Visual Studio.
1. Install openssl
2. Open wsdl2h.sln (gsoap-2.8\gsoap\VisualStudio2005\wsdl2h)

3. Property Page>Configuration Properties>C/C++>Command Line>Additional Options
    add /DWITH_OPENSSL 
4. Property Page>Configuration Progerties>C/C++>General>Additional Include Directories
    add ssl's include folder
    add plugin floder (gsoap-2.8\gsoap\plugin)
5. Property Page>Configuration Progerties>C/C++>Precompiled Headers>Precompiled Header
    Choose "Not Using Precompiled Headers"
6. Property Page>Configuration Progerties>Linker>General>Additional Library Directories
    add ssl's lib folder
7. Property Page>Configuration Progerties>Linker>Input>Additional Dependencies
    add libeay32.lib and ssleay32.lib

8. Source Files
    add Existing Item httpda.c, smdevp.c and threads.c (copy them from gsoap-2.8\gsoap\plugin)
9. BUILD>Rebuild Solution
10. Copy libeay32.dll and ssleay32.dll (from ssl's bin folder) to wsdl2h\release folder.

Now you can translate HTTPS's WSDL and XSD files to a gSOAP header file by wsdl2h.exe






2017年2月21日 星期二

Install openssl on Windows

openssl提供了TSL/SSL網際網路通訊安全協議的工具包。作者本身開發C/C++環境的Web service工具,在使用到https的網頁時,須引用openssl的library以及header檔。

在安裝前,須先確認開發工具為Win32或是x64。可點選Property頁面檢查Platform。

下載openssl。(下載頁面https://www.openssl.org/source/)
選擇有Long Term Support(LTS)的版本,在此我們下載openssl-1.0.2k.tar.gz。

解壓縮後,可在工具包根目錄下看到安裝說明INSTALL.W32/INSTALL.W64。
以下以W32環境說明
1. 安裝x86版本Perl (http://www.activestate.com/activeperl) ,也就是需在x86作業系統安裝。
2. 開啟 Visual Studio 2008 Command Prompt
> cd openssl folder
> perl Configure VC-WIN32 no-asm
> ms\do_ms
> nmake -f ms\ntdll.mak
> cd out32dll
> ..\ms\test
> cd ..
> nmake -f ms\ntdll.mak install (install to c:\usr)

以上過程執行成功後,會在C:\usr\local下看到ssl資料夾。其中C:\usr\local\ssl\lib以及C:\usr\local\ssl\include需設定在專案所引用的路徑。
以C/C++來說,就是在Property頁面
Configuration Properties>C/C++>General>Additional Include Directoriesr加入C:\usr\local\ssl\include
Configuration Properties>Linker>General>Additional Library Directories加入C:\usr\local\ssl\lib
Configuration Properties>Linker>Input>Additional Dependencies加入libeay32.lib;ssleay32.lib