Click here to Skip to main content
Licence CPOL
First Posted 13 May 2009
Views 27,536
Downloads 870
Bookmarked 11 times

Calling Web Services from Qt 4.5 using GSoap

By | 13 May 2009 | Article
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)

About the Author

Rohit Urs

Web Developer

United Kingdom United Kingdom

Member

Rohit Urs is currently into ASP .NET with C# development,Is intersted in search engines,
Search result clustering, Sharepoint, AJAX,RIA OpenGL,Qt C++ , F# and WebDAV.
has been working on various technologies for past 5+ years.
 
Loves Roller Skating and Air hockey.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generalmissed "stdsoap2.h" when I try to compile the project. Pinmemberpeteryu22:03 17 Sep '10  
QuestionCalling Web Service (writing in C#) from QT system client Pinmemberbonzaiholding0:36 15 Jul '10  
QuestionQt App as a web service? Pinmemberyaniv1723:42 3 Jul '10  
AnswerRe: Qt App as a web service? PinmemberRohit Urs3:40 8 Jul '10  
GeneralMy vote of 1 PinmemberThe Chip2:51 11 Feb '10  
GeneralMy vote of 1 PinmemberPatLeCat5:07 19 Jan '10  
GeneralRe: My vote of 1 PinmemberRohit Urs21:43 26 Jan '10  
AnswerRe: My vote of 1 PinmemberPatLeCat2:08 8 Feb '10  
GeneralRe: My vote of 1 PinmemberRohit Urs22:11 8 Feb '10  
GeneralNice article Pinmemberujjwal priyadarshan20:07 20 May '09  
GeneralRe: Nice article PinmemberRohit Urs20:50 21 May '09  
QuestionGSoap 0.01?? PinmemberPatLeCat4:10 14 May '09  
AnswerRe: GSoap 0.01?? PinmemberRohit Urs0:41 15 May '09  

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.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 13 May 2009
Article Copyright 2009 by Rohit Urs
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid