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 and other applications that benefit from an XML interface.
The gSOAP toolkit offers a comprehensive and transparent XML data binding solution for C and C++ through autocoding techniques. Autocoding saves developers substantial time to implement SOAP/XML Web services in C/C++. In addition, the use of XML data bindings significantly simplifies the use of XML in applications by automatically mapping XML to C/C++ data types. Application developers no longer need to adjust the application logic to specific libraries and XML-centric data representations such as DOM.
The gSOAP toolkit implements the XML data binding through the use of compiler technologies. These technologies map XML schemas to C/C++ definitions and vice versa. There are two main advantages to this approach. Firstly, strong typing is effectively leveraged to ensure data content validation of SOAP messages and XML documents. Secondly, compiler-based schema-specific parsing is more efficient than most other XML parsing techniques.
The gSOAP toolkit also generates WSDL and XML schemas (XSD) for existing C/C++ data types and application functions, thereby supporting and simplifying the conversion of legacy code into Web services. Code portability has been achieved for many platforms, including embedded systems and real-time software.
Getting Started: a quick how-to tutorial on gSOAP.Fact Sheet: a quick overview of key features.
Licensing: open source licensing model.
Download: get started today.
Here is a summary of 16 reasons why we believe you may want to try gSOAP for your projects:
Adobe Systems, AOL, BEA, Boeing, Cisco Systems, CNR, eBay, Ericsson, Exxon/Mobile, HP, IBM, Intel, Microsoft, Nokia, Pfizer, Siemens, WindRiver, Xerox, and many others (whose names we cannot disclose).
October 2008:
August 2008:
As an educator I came across the book "Web Services: Principles and Technology" by Michael P. Papazoglou. I highly recommend it for its comprehensive examination of Web services and related technologies.
January 2008:
Web Services Without Pain: gSOAP Writes Your XML, SOAP, and RPC. Short article shows the merits of gSOAP to generate SOAP/XML applications: "gSOAP can literally shave weeks and many thousands of dollars off of the cost of developing new server-client software."
June 2007:
MultiXTpm is an Application Server, Message Oriented Middleware (MOM) and Transaction Processing (TP) Monitor. It provides the runtime environment and rich API for developing large, scalable distributed applications for OLTP. The MultiXTpm gSoap enhancer addsfunctionality on top of gSoap and MultiXTpm.
April 2007:
The W3C Databinding Interoperability Results are available, with gSOAP stats included thanks to Hugo Haas and the W3C XML Schema Patterns for Databinding Interoperability working group. The mission of the working group is to determine the coverage of XML schema constructs by data binding tools for programming languages and frameworks, which will tell implementors in the relevant domain which parts of schema users are most likely to expect them to support well.
February 2007:
XML Journal SYS-CON article comparing gSOAP to other C/C++ Web services toolkits: Exposing SOA Enabled C Apps as Web Services by Mohit Chawla and Vijaya Bhaskar Peddinti.
November 2006:
Interested in using gSOAP Web service with UIQ 3 phones? Read Web services for UIQ 3 and gSOAP tutorial by Sony/Ericsson.
October 2006:
Read an introduction to gSOAP by Bo Xie from IBM with build instructions for MSVC++ 6.0: Use gSOAP to consume J2EE Web services created by WSAD through HTTP and HTTPS.
June 2006:
SOA World Magazine SYS-CON article on Leveraging gSOAP for Legacy Systems Integration by James Caple.
April 2006:
Surpassed 100,000 gSOAP toolkit downloads from SourceForge since 2003!
January 2006:
Pascal Botte shows how Lego Mindstorms fans can access the Lego RCX brick with gSOAP Web services. The new Lego Mindstorms NXT has arrived!
June 2005:
Are Web services scale free? Find out.
June 2005:
A recent patent granted to Microsoft on "XML Serialization" has caused some commotion, see XML serialization patent and prior art. The basis of the gSOAP software pre-dates Microsoft's XML serialization patent and is thus considered prior art: Gunjan Gupta's Master's project conducted in my research lab implemented an XML serialization algorithm in a compiler we developed for C, based on a SOAP and XML mapping that we developed in 1999. The project report TR-001205 was filed in the Department of Computer Science in 2000 before Microsoft's patent was filed. Shows that it is good we lead rather than follow (the Web services technology).
May 2005:
A feature article on gSOAP appeared in Linux Magazine for the Linux (and gSOAP!) enthousiasts in France.
February 2005:
See our feature article gSOAP & Web services in the C/C++ Users Journal February issue on Web Services and C++!
August 2004:
The gSOAP toolkit received a five star rating in all categories in a recent survey study of C++ Web services tools: see CRN survey article for more details.
July 2004:
iAnywhere/AvantGo are using gsoap for their M-Business Anywhere server. M-Business Anywhere provides a platform for delivering Web-based content and applications to a wide variety of mobile devices rapidly and cost-effectively with minimal recoding.
March 2004:
The release of Borland C++BuilderX 1.5 brings several new solutions for Symbian OS including the first, native C++, Rapid Application Development (RAD) support. A port of gSOAP will ease the job of enterprise developers who want to use Web Services to mobilize corporate data to Symbian OS phones. Read more.
December 2003:
New WSDL tools (WSDL parser, import, and generator) are released as part of the gSOAP 2.4 releases. The new WSDL parser includes many enhancements for developing SOAP 1.1/1.2 RPC, literal encoding, and document style Web services.
November 2003:
IBM released the IBM Tivoli Access Manager for e-business. The Tivoli Access Manager is an award winning, policy-based access control solution for e-business and enterprise applications. Part of the Tivoli Access Manager uses gSOAP.
November 2003:
The OFACSearch application developed with gSOAP by the Oasis Group is used to help companies comply with the Treasury Department's Office of Foreign Assets Control (OFAC) regulations.
October 2003:
Adobe's Version Cue, an innovative file-management feature of the recently unveiled Adobe Creative Suite, uses gSOAP as the foundation of its SOAP services client.
October 2003:
The BEA WebLogic Enterprise Security product line is family of security solutions that provide enhanced application security that includes policy-based delegated administration, authentication with single sign-on, consolidated auditing, and dynamic-role and policy-based authorization with delegation. Part of this product uses the gSOAP library.
October 2003:
Foundstone 3.0 Professional, an advanced network security analysis and protection tool, uses gSOAP as part of its data communication framework.
October 2003:
ObjectStore released its Real-Time Event Engine 3.0, a high-performance application solution for the real-time capture, organization and simultaneous query of streaming financial event data. The Event Engine combines extreme scalability with a flexible "Cache-Forward" architecture to support real-time analysis on streaming event data in distributed environments, without impacting capture or query speeds. The Real-Time Event Engine is based on gSOAP.
September 2003:
The AOL 9.0 YGP (You've Got Pictures) team used gSOAP to provide the foundation for the SOAP services client included in the AOL 9.0 product.
July 2003:
PalmSource in partnership with IBM offers a Web Services Toolkit for Mobile Devices based on gSOAP.
read more...
May 2002:
CapeClear article on Web Services for C and C++ Applications.
Download the latest gSOAP package from the SourceForge gSOAP project site. The gSOAP distribution package includes two compiler tools to develop your applications:
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.
The next section explains how these tools are used to build client and server applications.
We use the gSOAP 'wsdl2h' WSDL parser to obtain the gSOAP header file specification of a Web service from a WSDL document.
To obtain a header file from a WSDL document, run 'wsdl2h' on a WSDL:
wsdl2h -o outfile.h infile.wsdl |
wsdl2h -o XMethodsQuery.h http://www.xmethods.net/wsdl/query.wsdl |
Next, we run the gSOAP compiler 'soapcpp2' on the gSOAP header file to produce the source code to implement the client application. The 'soapcpp2' stub and skeleton compiler generates proxies (and RPC stubs) for your client application, as illustrated below.
The gSOAP runtime library provides a transport layer with an HTTP stack on top of TCP/IP as well as secure SSL and DIME/MIME attachment support.
To develop a service application, run the gSOAP 'wsdl2h' parser on a WSDL to create a gSOAP header file. The header file is compiled with the 'soapcpp2' compiler:
The 'soapcpp2' compiler generates the C/C++ Web service skeletons. You can also take a legacy C/C++ application and develop a service simply by entering the C/C++ Web service method operations and data types into a header file. The 'soapcpp2' compiler generates the source code for your project and produces a WSDL to advertize your Web service.
The XMethods Delayed Stock Quote Web Service provides a delayed stock quote for a given ticker name, see XMethods Delayed Stock Quote for details. The WSDL description of the Delayed Stock Quote Web Service provides the following details:
|
The gSOAP 'wsdl2h' WSDL parser tool converts the WSDL:
wsdl2h -c -o quote.h http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl |
The -c options ensures that the client application can be developed in pure C. The generated quote.h file contains:
//gsoap ns1 service name: net_DOTxmethods_DOTservices_DOTstockquote_DOTStockQuoteBinding //gsoap ns1 service type: net_DOTxmethods_DOTservices_DOTstockquote_DOTStockQuotePortType //gsoap ns1 service port: http://66.28.98.121:9090/soap //gsoap ns1 service namespace: urn:xmethods-delayed-quotes //gsoap ns1 service documentation: Definitions generated by the gSOAP WSDL parser 1.0 // Service net.xmethods.services.stockquote.StockQuoteService : net.xmethods.services.stockquote.StockQuote web service //gsoap ns1 service method-style: getQuote rpc //gsoap ns1 service method-encoding: getQuote http://schemas.xmlsoap.org/soap/encoding/ //gsoap ns1 service method-action: getQuote urn:xmethods-delayed-quotes#getQuote int ns1__getQuote(char *symbol, float &Result); |
(Note: the contents may vary depending on the 'wsdl2h' release.)
Because the name of the service is a bit lengthy, we rename it in the header file into something simpler for sake of convenience:
//gsoap ns1 service name: Quote |
The gSOAP stub and skeleton compiler is invoked on this quote.h header file from within an IDE (e.g. MSVC++ or Borland C++), from a makefile, or from the command line with:
soapcpp2 -c quote.h |
The following function is generated by the gSOAP compiler:
int soap_call_ns1__getQuote(struct soap *soap, char *URL, char *action, char *symbol, float &Result); |
The following C client program invokes the proxy to retrieve the latest IBM stock quote from the XMethods Delayed Stock Quote service:
#include "soapH.h" // obtain the generated stub #include "Quote.nsmap" // obtain the generated XML namespace mapping table for the Quote service main() { struct soap *soap = soap_new(); float quote; if (soap_call_ns1__getQuote(soap, NULL, NULL, "IBM", quote) == SOAP_OK) printf("Current IBM Stock Quote = %g\n", quote); else // an error occurred soap_print_fault(soap, stderr); // display the SOAP fault on the stderr stream } |
#include "soapQuoteProxy.h" // get proxy #include "Quote.nsmap" // get namespace bindings int main() { Quote q; float r; if (q.ns1__getQuote("IBM", r) == SOAP_OK) std::cout << r << std::endl; else soap_print_fault(q.soap, stderr); return 0; } |
Use the gSOAP 'wsdl2h' WSDL parser to create a header file for a service you want to develop, or you can write your own header file specifications to develop a new Web service. The latter approach is useful when you don't have a WSDL to start with and you don't want to bother with the details of the WSDL specification. The following example specifies a new SOAP Web calculator service in a header file. We don't use the WSDL parser to create a service, because we can define the service in a header file and let the gSOAP 'soapcpp2' compiler generate a WSDL for us instead. We want to develop a service that implements three remote methods using SOAP RPC encoding (note: doc/lit is the default):
// Contents of file "calc.h": //gsoap ns service name: calculator //gsoap ns service style: rpc //gsoap ns service encoding: encoded //gsoap ns service port: http://mydomain/path/calculator.cgi //gsoap ns service namespace: urn:calculator int ns__add(double a, double b, double &result); int ns__sub(double a, double b, double &result); int ns__sqrt(double a, double &result); |
The add and sub methods are intended to add and subtract two double floating point numbers stored in input parameters a and b and return the result of the operation in the result output parameter. The sqrt method is intended to take the square root of input parameter a and to return the result in the output parameter result.
The gSOAP stub and skeleton compiler is invoked on this calc.h header file from within an IDE (e.g. MSVC++ or Borland C++), from a makefile, or from the command line with:
soapcpp2 calc.h |
The compiler generates the skeleton routines and a WSDL description of the service. Here is an example Calculator service application that uses the generated skeletons. The soap_serve routine handles client requests:
// Contents of file "calc.cpp": #include "soapH.h" #include "calculator.nsmap" #include <math.h> main() { soap_serve(soap_new()); // call the incoming remote method request dispatcher } // Implementation of the "add" remote method: int ns__add(struct soap *soap, double a, double b, double &result) { result = a + b; return SOAP_OK; } // Implementation of the "sub" remote method: int ns__sub(struct soap *soap, double a, double b, double &result) { result = a - b; return SOAP_OK; } // Implementation of the "sqrt" remote method: int ns__sqrt(struct soap *soap, double a, double &result) { if (a >= 0) { result = sqrt(a); return SOAP_OK; } else { return soap_sender_fault(soap, "Square root of negative value", "I can only compute the square root of a non-negative value"); } } |
The implementation of the remote methods return a SOAP status code. The code SOAP_OK denotes success, while soap_sender_fault returns an exception. This application is intended to run as a CGI application at the specified location (http://mydomain/path/calculator.cgi). However, you can build a stand-alone HTTP/HTTPS Web server that serves regular dynamic HTML content and SOAP/XML Web services, see the gSOAP Web Server screen dump. You can also use Apache_mod, WinInet, IIS, or Fast CGI.
When citing the gSOAP project, please cite the following paper that first introduced gSOAP:
Other gSOAP and Web services-related publications: