Click here to Skip to main content
15,886,685 members
Articles / Programming Languages / C++

Calling Web Services from Qt 4.5 using GSoap

Rate me:
Please Sign up or sign in to vote.
3.25/5 (9 votes)
13 May 2009CPOL1 min read 64.3K   1.9K   12   13
Calling Web Services from Qt 4.5 using GSoap.

Introduction

Looked around for a Qt with GSoap working sample straight-out-of-a-tar file, I failed to find one. So I thought I'd put one together. This is not a beginner tutorial for someone who wants to use Qt, nor does it give any introduction to GSoap. It is for folks who are quite conversant with Qt and Web Services, and want to use GSoap.

Overview

I am using: XUbuntu 8.10, with QT 4.5, GSoap 1.2.9l.

In my reckoning, there is nothing much to explain here. The code is pretty much self explanatory. I guess we need to pay particular attention to the .pro file and the files that need to be included.

Qt provides QtSoap to achieve something on the lines of GSoap. Well, with many using it, and GSoap being around for sometime and quite mature, I decided to go ahead with it.

The .pro file

I noticed much ado was about how the .pro file should look like. Well, here it is:

# -------------------------------------------------
# Project created by QtCreator 2009-05-04T22:46:55
# -------------------------------------------------
TARGET = qtQuote
TEMPLATE = app
 QT += xml\
xmlpatterns
INCLUDEPATH += /usr/include/gsoap
LIBS += -lgsoap++
SOURCES += main.cpp \
    mainwindow.cpp \
    soapC.cpp \
    soapStockQuoteSoapProxy.cpp
HEADERS += mainwindow.h \
    soapStockQuoteSoapProxy.h \
    soapStub.h \
    soapH.h
FORMS += mainwindow.ui

Application screenshot

The window which takes in the stock symbol will spit out the XML onto the text area below.

QtGsoap

Fairly basic, but what I wanted to show was a scaffolding to hold Qt and GSoap together. With QXmlQuery/QDom/SAX, we get the desired data-point out of the XML response.

Points of interest

Funnily though, even after I'd installed GSoap using Synaptic, I had to locally place the SoapCpp2.h, error2.h to make the app run. Also, we will have to see how it is going to build on OS X and Windows.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United Kingdom United Kingdom
*Techie*

Comments and Discussions

 
Generalmissed "stdsoap2.h" when I try to compile the project. Pin
peteryu17-Sep-10 22:03
peteryu17-Sep-10 22:03 
QuestionCalling Web Service (writing in C#) from QT system client Pin
bonzaiholding15-Jul-10 0:36
bonzaiholding15-Jul-10 0:36 
QuestionQt App as a web service? Pin
yaniv173-Jul-10 23:42
yaniv173-Jul-10 23:42 
AnswerRe: Qt App as a web service? Pin
Rohit U8-Jul-10 3:40
Rohit U8-Jul-10 3:40 
GeneralMy vote of 1 Pin
The Chip11-Feb-10 2:51
The Chip11-Feb-10 2:51 
incomplete
GeneralMy vote of 1 Pin
PatLeCat19-Jan-10 5:07
PatLeCat19-Jan-10 5:07 
GeneralRe: My vote of 1 Pin
Rohit U26-Jan-10 21:43
Rohit U26-Jan-10 21:43 
AnswerRe: My vote of 1 Pin
PatLeCat8-Feb-10 2:08
PatLeCat8-Feb-10 2:08 
GeneralRe: My vote of 1 Pin
Rohit U8-Feb-10 22:11
Rohit U8-Feb-10 22:11 
GeneralNice article Pin
ujjwal priyadarshan20-May-09 20:07
ujjwal priyadarshan20-May-09 20:07 
GeneralRe: Nice article Pin
Rohit U21-May-09 20:50
Rohit U21-May-09 20:50 
QuestionGSoap 0.01?? Pin
PatLeCat14-May-09 4:10
PatLeCat14-May-09 4:10 
AnswerRe: GSoap 0.01?? Pin
Rohit U15-May-09 0:41
Rohit U15-May-09 0:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.