Using gSoap in a Cascades C++ project. For Developer on Windows

by Developer on ‎07-02-2014 02:36 PM (780 Views)

gSOAP is an open source C and C++ software development framework for SOAP/ XML.

http://www.cs.fsu.edu/~engelen/soap.html

 

This article demonstrates how to use gSoap in a Cascades™ C++ project. In order to do so, we will need to build the gSOAP LIB with BlackBerry® 10 Native SDK.

 

 

The instructions for compiling the gSOAP LIB for QNX/ARM on *nix and MAXOSX werementioned here:

http://supportforums.blackberry.com/t5/Cascades-Development-Knowledge/Using-gSoap-in-a-Cascades-C-pr...

I give big thanks to this article as a base for my article.

 

 

So I will give the instruction for Windows Developer. (From this post, http://supportforums.blackberry.com/t5/Cascades-Development/GSoap/td-p/2363127)

 

My instruction use CygWin to build and were tested with gSOAP 2.8.14

 

 

  1. Prepare the environment.
    • Download and Install Cygwin, remembering to install gcc, g++, make, automake, autoconfigure, byacc, and flex when installing Cygwin.
    • Start CygWin
    • Set up the environment
      source  /cygdrive/<your bbndk install drive>/<path to bbndk>/bbndk/bbndk-env.sh
    • For example, if you install bbndk at C:\bbndk, you should exec this command
      source  /cygdrive/c/bbndk/bbndk-env.sh
  2. Define C preprocessor flags to enable SSL/ZIP/COOKIES support
    export CPPFLAGS=" -D__QNXNTO__ -DWITH_OPENSSL -DWITH_GZIP -DWITH_COOKIES "

     Please refer the readme within the gsoap source package if you wish to enable or disable other features.

  3.  Change Directory to your gSOAP source code folder
    • I recommend you put your source code at your home folder of your CygWin user, in the path /home/<User>
    • Change the folder using the cd command, file path is in the format /cygdrive/<drive letter>/path/to/src/folder
  4. Configure the build target to be a BlackBerry® 10 device and specify where to install the generated LIBs
    ./configure --host=arm-unknown-nto-qnx8.0.0eabi --prefix=/<path>/<to>/<install>/libgsoap
    Note: when this article was written, the QNX tool chain bundled with Native SDK was at version 8.0.0. You may need to adjust it accordingly if you have a different version of QNX tool chain.
  5.  Build the gSoap LIBs.
    make | make install

    There will be errors indicating that it cannot launch “soapcpp2”, which is expected, since the generated “soapcpp2” is targeted for QNX/ARM.

    The gSoap build script tries to use this tool to compile files for building another tool “wsdl2h”, which, fortunately, we don’t need either.

    Note: “soapcpp2” and “wsdl2h” are the tools needed for generate C/C++ stub. The gSoap source package already contains the prebuilt executables for Mac, Linux and Windows, which can be located under

    /gsoap-2.8/gsoap/bin

    Everything we need is located at:

     /<path>/<to>/<install>/libgsoap

    The header we need is located in the include folder of that folder; the lib we need is located in the lib folder; all the extensions are located in the share folder.

    There will be 6 libs:

         libgsoap++.a

         libgsoap.a

         libgsoapck++.a

         libgsoapck.a

         libgsoapssl++.a

         libgsoapssl.a

     

    The libs with name containing “++”  are C++ libs.

     

    REFERAL: