Click here to Skip to main content
11,569,831 members (56,872 online)
Click here to Skip to main content

Calling Web Services from Qt 4.5 using GSoap

, 13 May 2009 CPOL 40.3K 1.5K 12
Rate this:
Please Sign up or sign in to vote.
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)

Share

About the Author

Rohit U
United Kingdom United Kingdom
*Techie*

You may also be interested in...

Comments and Discussions

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

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150624.2 | Last Updated 13 May 2009
Article Copyright 2009 by Rohit U
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid