The client program will accept the names of two countries from the command line and will display the current exchange rate.
The input to our stub compiler is a specification of the name of the SOAP method (with it's optional namespace) and the data structures given as C/C++ declarations. For this example, the input to the compiler is just a function prototype:
int ns1__getRate(char *country1, char *country2, float *result);
The method name is "getRate" with namespace identifier "ns1" and it has two input string parameters "country1" and "country2" and one output float parameter "result" passed by reference. Note that the paramter names correspond to the request and response XML schema definitions for the getRate method as found on the Xmethods web site.
To generate the sources, click here to use our SOAP Stub Compiler. This will produce a web page containing the C/C++ sources for:
soapStub.h soapH.h soapC.cpp soapClient.cpp soapServer.cppYou need to save these sources to your local drive under the file names as indicated.
Two files are not generated but are required to build your application: stdsoap2.h and stdsoap2.cpp. Save these files to your local drive too.
g++ -o exchange exchange.cpp soapC.cpp soapClient.cpp stdsoap2.cpp
Exhange rate us to uk is 0.706964(as of 8/8/2001.)
For a list of country names, see Currency Exchange Rate.