gSOAP is an open source C and C++ software development framework for SOAP/ XML.
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 following instructions of cross compiling the gSOAP LIB for QNX/ARM are applicable for the Native SDK on Linux® or Mac. For the Native SDK for Windows®, they have to be adjusted accordingly. The instructions were tested with gSoap 2.8.
1. Prepare the Native SDK environment for the tool chain used for cross compiling.
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. 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>/gsoaplib
Note: when this article is written, the QNX tool chain bundled with Native SDK is at version 8.0.0, you may need to adjust it accordingly if you have a different version of QNX tool chain.
4. Edit the “config.h” generated at step 3, comment out this line
//#define malloc rpl_malloc
5. Build the gSoap LIBs.
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
6. Copy the generated gSoap LIBs
At this stage, we can just ignore the errors and copy the generated libs to the directory which we specified during configure.
e.g.: The libs can be located under:
There will be 6 libs:
The libs with name containing “++” are C++ libs.
To use gSoap LIB in a Cascades C++ project, We only need one header file (e.g.: stdsoap2.h) which can be found in the gSoap source (located under /gsoap-2.8/gsoap/stdsoap2.h) to use these libs.
Please refers to KB
For how to use third party LIBs in a Cascades C++ project.
Also, Please refer the gSoap online manual for how to use gSoap tools to generate C/C++ stub.
WARNING: When this article is written, it appears that the C++ stub generated by the gSoap tools have conflicts with the Dinkum C++ library. We have to use only the gsoap C LIBs in Cascades C++ projects for the time being.