The Generated Sample Implementation
The generated sample implementation provides a simple implementation for the service.
The generated sample header, DayOfWeekPortTypeImp.h, shows the basic structure of a class derived from the server implementation base class. The code below shows the implementation declaration from the file:
#include "DayOfWeekExample/DayOfWeekPortTypeBase.h" //1
DayOfWeekPortTypeImp : public DayOfWeekPortTypeBase //2
virtual std::string getDayOfWeek(rwsf::CallInfo& callInfo, //3
const std::string& date_in);
//1 Includes the definition of the generated implementation base class, DayOfWeekPortTypeBase.
//2 Derives the concrete implementation class DayOfWeekPortTypeImp from the base class.
//3 Declares the getDayOfWeek method. Notice that this function handles the SOAP request as a C++ method call. The message handler parses the SOAP message received from the client to create the string provided to the getDayOfWeek method. The message handler translates the string that the method returns into a SOAP response.
The callInfo parameter is used for passing any additional information to the implementation, such as session data, SOAP headers, and transport headers. For information on HydraExpress’s support for advanced headers, see Chapter 15, SOAP and Transport Headers. To use the callInfo parameter for session support, see Chapter 18, Sessions and State.
Now let’s look at the generated sample implementation (named DayOfWeekPortTypeImp.cpp).
#include "DayOfWeekPortTypeImp.h" //1
std::string DayOfWeekPortTypeImp::getDayOfWeek(rwsf::CallInfo& callInfo,const
std::string& date_in)
typedef std::string returnType;
throw rwsf::ServerFault("Sorry: the service was invoked but the "
"requested operation \"getDayOfWeek\" has "
"not been implemented. An implementation "
"must be written."); //3
return returnType(); // (never executed) //4
//1 Includes the header for the derived implementation class.
//2 This macro registers your service and is correctly declared and implemented if you use the default name for the implementation class. See Using a Different Implementation Name for information on how to use a different name for the implementation class.
//3 Throws a rwsf::ServerFault notifying the client that the operation is not yet implemented.
//4 Returns a default-constructed std::string. Note that this line is unreachable. The sample includes this line for documentation purposes and to quiet compiler warnings.