• Article
• Comment
• View source
• History
With the time-to-market being so critical for mobile applications, One would certainly like to
have as much reusable components as possible. This is where generic components come into
picture.
Contents
[hide]
• 1 Problem statement
• 2 What is gSOAP
• 3 Why gSOAP
• 4 How to use gSOAP
o 4.1 Step1: Generating the header file
o 4.2 Step2: Generating C++ code
o 4.3 Step3: Include generated file to your project directory
Problem statement
Let us say you want to design a S60 application with SOAP/XML web services communication.
Nokia provides a WSDL-to-C++ tool to generate stubs from wsdl file and Xmldatabinding
libraryto run this code. However, later if you decide to port this application to UIQ( or even
Samsung S60 devices), you need to re-design your application as this library is provided by
Nokia and doesn't work on other platforms or even S60 devices from other manufacturers. How
to avoid this problem by making the SOAP communication generic for all platforms. The answer
is gsoap.
What is gSOAP
A cross-platform open source C and C++ software development toolkit. Generates C/C++ RPC
code, XML data bindings, and efficient schema-specific parsers for SOAP Web services.
Why gSOAP
The primary reason to go for gSOAPis portability.gSOAP supports most platforms, including
embedded systems and small OS (for example WinCE, Symbian, and PalmOS).
'wsdl2h' WSDL parser: This tool converts WSDLs and XSD files into annotated C/C++
definitions.
'soapcpp2' stub and skeleton compiler :This tool generates RPC code and XML serializers
from the annotated C/C++ definitions.
The 'wsdl2h' parser converts WSDL into gSOAP header file specifications of Web services. This
specification gives a C/C++ transparent view of the server's functionality. The header file is
processed by 'soapcpp2' to generate the source code stubs and skeletons to invoke the service or
build a new service based on the WSDL.
-s indicates that code that relies on STL should not be generated since the
STL is not available for Symbian.
soapcpp2 -t -C -L soapProxy.h
void CMyUpdater::StartL()
{
TInt id = iThread2.Handle ();
if ( (id==KCurrentThreadHandle)||(id==0))
{
}
}
void CMyUpdater::RunL()
{
if ( iStatus==KErrDied || KErrCancel)
{
//indicate the webservice response is processed - Ani
iThread2.Close ();
}
else
{
SetActive ();
}
CActiveScheduler::Install (sched);
TRAPD(err,ptr->IssueRequestL());
CloseSTDLIB();
void CMyUpdater::IssueRequestL()
{
//Issue web service request here and check for response
}
Retrieved from "http://wiki.forum.nokia.com/index.php/Using_gsoap_for_web_services"
Nguon: http://www.helloandroid.com/tutorials/using-ksoap2-android-and-parsing-
output-data