Using the Asynchronous API
For each operation defined in the WSDL, the code generator creates five service operation methods to choose from when implementing the client. These include:
Two synchronous methods, one taking a
rwsf::CallInfo object as a parameter, and one without, as follows:
std::string <methodName>(const std::string& input_in);
std::string <methodName>(rwsf::CallInfo& callInfo,
const std::string& input_in);
If you are creating a synchronous client, choose one of these methods to implement in the
invoke<methodName>() method of the client. The client implementations generated by HydraExpress use the method that includes
rwsf::CallInfo because it simplifies coding if you want to modify the message handling such as by adding headers to the message.
Three asynchronous methods, including two
<methodName>Start() methods, and a
<methodName>End() method, as follows:
rwsf::AsyncHandle <methodName>Start(
const std::string& input_in);
rwsf::AsyncHandle <methodName>Start(
rwsf::CallInfo& callInfo,
const std::string& input_in);
std::string <methodName>End(rwsf::AsyncHandle& handle);
The
<methodName>Start() method sends the request to the server and receives an
rwsf::AsyncHandle object in return. The handle’s method
isFinished() may then be used to poll for whether the response is available.
Like for the synchronous methods, the generated client implementation again uses the variant of
<methodName>Start() with
rwsf::CallInfo, and for the same reason.
Call the
<methodName>End() method to obtain the response, passing in the
rwsf::AsyncHandle object received from
<methodName>Start(). If the response is not ready, the
<methodName>End() method blocks. There is no way to prematurely abort the operation and free its resources. You must wait for the operation to complete.