Listing 14: client.cpp.
#include <iostream>
#include <waspc/common.h>
#include <waspc/runtime/Runtime.h>
#include "DateTime.h"
using std::cout;
using std::cerr;
using std::endl;
int main (int argc,char *argv[]) {
WASP_Runtime::clientInitialize ();
try {
WASP_Runtime::clientStart("conf/client.xml", NULL);
DateServer DateTimeService;
WASP_DateTime *currDateTime;
currDateTime = DateTimeService.getCurrentDateTimeWS();
char *dt_string = currDateTime->toString()->transcode();
cout << "The current date & time is " << dt_string << endl;
delete dt_string;
delete currDateTime;
}
catch (WASP_Exception *exc) {
char *trace=GET_TRACE (exc);
cerr << "Exception during call: " << exc->getCharMessage() <<
endl;
cerr << "Stack trace follows: " << endl << trace << endl;
delete[] trace;
delete exc;
}
WASP_Runtime::clientTerminate();
return 0;
}