The API itp.ServerCallEx provides the ability to call ITP/Server services that use the ITP/OnLine submission protocol, such as ITPOLSSuspendSession.
Stream ServerCallEx (Page page,
string service,
string sessionid,
Stream uploadableStream,
string uploadType,
out string downloadedStreamType,
out string newSessionId,
params string[] parameters)
Parameters:
page should be the current ASP.NET Page object, usually one should pass this.service indicates the ITP/Server service that should be called.sessionid indicates the ITP/Server session ID that should be used. This is usually Request.QueryString["sessionid"], but can be null to indicate that the script should not be run in an ITP/Server session.uploadableStream can be used to upload a file to the ITP/Server service. If no upload is necessary, this parameter should be null.uploadType is used to indicate the type of information that is being uploaded. The file is only uploaded to ITP/Server if the called service specifies this same string in the Src parameter of the ReceiveFile command that it uses to receive the file.downloadedStreamType indicates the type of information that is contained in a stream that was downloaded, if any. This corresponds to the value of the Dest parameter of the SendFile command that is issued by the ITP/Server service to send the file.newSessionId is filled with the new session ID issued by ITP/Server, if it did in fact issue a new one. This session ID is only filled if it is communicated by the called ITP/Server service using the exchange_data function, with key "sessionid".The return value of the itp.ServerCallEx API is a Stream object for the file that was downloaded from ITP/Server, if any. The type of data that was downloaded is indicated by the output parameter downloadedStreamType.
The following example is based on the default implementation of the modelsuspend.aspx exit point. It calls the ITPOLSSuspendSession service on ITP/Server to suspend the current session, returning a file stream containing the information of the suspended session:
String downloadedStreamType;
String newSessionId;
String sessionid = Request.QueryString["sessionid"];
// Call ITP/Server service ITPOLSSuspendSession.
Stream s = itp.ServerCallEx (this,
"ITPOLSSuspendSession",
sessionid,
null,
"",
out downloadedStreamType,
out newSessionId,
"dummy parameter value");
// Make sure that we received a file with name "session".
if (s == null || downloadedStreamType != "session")
{
throw new Exception("ITPOLSSuspendSession service sent" +
" no file or an unexpected file type \"" +
downloadedStreamType +
"\", expecting type \"session\"");
}
In this example, the parameter value "dummy parameter value" is passed as a parameter to the ITPOLSSuspendSession service. Because the uploadableStream parameter is null, no file will be uploaded to ITP/Server in this call.