The Provided Sample Implementation
To complete the service, we need to implement the method
getDayofWeek() in the service implementation. For the purposes of this example, we will use the
provided sample implementation
DayOfWeekPortTypeImp.cpp rather than editing the above
generated one. The provided implementation implements the
getDayofWeek() method using class
rwsf::DateTime which provides a method that returns the day of the week for any valid date.
Let’s look at the code. Here’s an excerpt from the provided implementation DayOfWeekPortTypeImp.cpp located in your <installdir>\examples\DayOfWeek directory.
std::string
DayOfWeekPortTypeImp::getDayOfWeek(rwsf::CallInfo& info,
const std::string& date_in)
{
std::string dateStr(date_in); //1
rwsf::DateTime dt(dateStr, rwsf::DateTime::setDate); // 2
// need to convert from DateTime to std::string to return to client
std::string weekDay = dt.weekDayName(); // 3
return weekDay;
}