Web Services Client for C++ enables you to manage messaging between a client and web service server.
Web services are based on files called WSDLs, which are XML files containing all the information relating to services that are available at a particular location on the internet. At their simplest level, WSDLs describe request and response message pairs in detail, and contain all the information that is relevant to the web service. The Web Services Client for C++ package provides a Java program, the WSDL2Ws tool. This tool enables you to turn a WSDL into a suite of C++ stubs and data objects that you can call and pass information to, and that request information from the server and then wait for the corresponding reply before passing the response data objects back to the client. The stubs hide the internet communication from the application writer. All you need to know is the name of the service, the method it contains and the structure of any data objects that are passed.
There are two distinct ways of using Web Services Client for C++:
Both of these approaches work well, but the second approach is not recommended because the client application writer has to be more aware of the API and of the communication protocols between the client and server. Also, if changes are required, the writer has to make the changes to the code manually, which is more prone to error. The recommended implementation is to use a WSDL to describe messages and any associated XSD, and then use the WSDL2Ws tool to generate the stubs.
The following three diagrams describe the actions that are required to turn a WSDL into a web service using this recommended implementation of Web Services Client for C++.
Figure 1 illustrates the first step, which is to convert the WSDL into a set of C++ client stubs that can be called by the client application.
As shown in Figure 2, the client application calls a method on a service in the stubs. This method calls a number of underlying methods in the AxisClient library, which generates the SOAP message that communicates with the server.
You can add web service handlers to the AxisClient library to allow further processing of the SOAP message, either before it is transmitted to the server or after the corresponding reply has been received from the server. The Web Service Deployment Descriptor (WSDD) file controls how handlers are used. Figure 3 is an amended version of Figure 2, showing how handlers can be hooked into the AxisClient library.