Browse DevX
Sign up for e-mail newsletters from DevX


Developing Web Services in C++, Part II

Part I of this series set out to address the shortage of information on C++ and Web services, showing readers how to create a C++ Web service client. Part II continues the mission by describing how to author an actual Web service, using SOAP, C++, and a little Java.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

n this article, I will demonstrate how to write a SOAP service in C++. The service is simple and consists of two operations; one to convert Fahrenheit to Celsius, the other to covert Celsius to Fahrenheit. I will also show the accompanying client code, but will not discuss the implementation as it differs only slightly from the Google client discussed in Part I. Part I also gave a brief introduction to SOAP and WSDL, with links to other resources for a more in-depth discussion. Part II assumes a basic understanding of these standards.

Resources You'll Need
Before you can begin writing any source code, it is necessary to get your house in order. You'll need to get a copy of Systinet's WASP Server for C++ that is appropriate for your environment, and Systinet's WASP Server for C++ Companion Tools.

WASP is available for a variety of operating systems and compilers as a free download from Systinet. It is also available for free deployment on single CPU machines. Purchasing a license is only necessary for deployment on multi-CPU hardware. Obviously, you will also need a C++ compiler. In my case, I am using Red Hat Linux 7.3 and gcc 2.96. You'll need a 1.3 or better JVM as well, if you don't already have one.

Install both WASP products according to the documentation. Set the WASPC_HOME environment variable to point to the WASP Server for C++ installation directory. It is also helpful to add the bin directories for both products to your PATH, and to create directories for your new service and client. Translate the code below as necessary for your environment.

$ export WASPC_HOME=/path/to/waspforc++ $ export PATH=$PATH:/path/to/waspforc++/bin:/path/to/companiontools/bin $ mkdir service client $ cd service

Thanks for your registration, follow us on our social networks to keep up-to-date