public method IO2GResponseListener.onRequestFailed
Brief
Processes a notification about a request failure.
| Declaration | ||||
|
||||
| Parameters | |
requestId |
The identifier of the failed request. A session object may send multiple requests
(see the O2GSession.sendRequest method).
The method receives notifications of all the requests that have failed. To make sure you are getting a notification
about a particular request, you must check whether or not the value of this parameter matches the value obtained by calling the
|
error |
The server error message. For the list of errors that may be generated during an order processing, refer to the Order Execution Errors section. |
Details
In order to process a notification about a request failure, an instance of the class implementing the IO2GResponseListener interface
must be subscribed to a session object.
It is accomplished by calling the O2GSession.subscribeResponse method.
Process a notification about a request to get open positions [hide]
// Create a request to get open positions information
O2GRequestFactory requestFactory = session.getRequestFactory();
if (requestFactory != null)
{
O2GRequest request = requestFactory.createRefreshTableRequest(O2GTableType.Trades);
responseListener.setRequest(request.RequestID);
session.sendRequest(request);
Thread.Sleep(1000);
}
// Set request in the implementation of IO2GResponseListener interface
public void setRequest(String requestID)
{
mRequestID = requestID;
}
// Implementation of IO2GResponseListener interface public method onRequestFailed
public void onRequestFailed(String requestID, String error)
{
if (requestID.Equals(mRequestID))
{
Console.WriteLine("Request failed. requestID= " + requestID + "; error= " + error);
}
}
Declared in IO2GResponseListener