/
EagleML Web Service - Synchronous Request

EagleML Web Service - Synchronous Request

Synchronous requests are usually used for data of small volume. To make a synchronous, request prepare a synchronous RunTaskRequest message and call the RunTaskRequestSync method.

The following GenerateSyncRunTaskRequest method should be added:

//create sync runtaskrequest message for making SMF extract         private static eagleSvc.WSRunTaskRequest GenerateSyncRunTaskRequest()         {             //create WSRunTaskRequest object             var runTaskRequest = new eagleSvc.WSRunTaskRequest();             //create RunTaskRequest object             var eagleML = new eagleSvc.RunTaskRequest();             //create header section             var header = new eagleSvc.RequestMessageHeader();             //set messageId             header.messageId = new eagleSvc.MessageId { Value = "ID:SYNCSMFEXTRACT01" };             //set sendBy             header.sentBy = new eagleSvc.MessageAddress { Value = "user" };             //set sendTo , sendTo must be http://www.eagleinvsys.com/eagle_ml-2-0_default_cm_control_message             header.sendTo = new eagleSvc.MessageAddress[1] { new eagleSvc.MessageAddress { Value = "http://www.eagleinvsys.com/eagle_ml-2-0_default_cm_control_message" } };             //set timestamp             header.creationTimestamp = DateTime.Now;             eagleML.header = header;             //create taskidentifier section             var taskIdentifier = new eagleSvc.TaskIdentifier();             //set correlationId, must be unique             taskIdentifier.correlationId = new eagleSvc.CorrelationId { correlationIdScheme = "correlationIdScheme", Value = GenerateUID() };             //set businessTaskId             taskIdentifier.businessTaskId = new eagleSvc.CorrelationId { correlationIdScheme = "businessTaskIdScheme", Value = "SYNC_SMFIST_EXTRACT" };             eagleML.taskIdentifier = taskIdentifier;             //set TaskTypeEnum             eagleML.taskTypeEnum = eagleSvc.TaskTypeEnum.LOAD;             //create and set task parameters             var taskParameters = new eagleSvc.TaskParameter[4];             taskParameters[0] = new eagleSvc.TaskParameter { name = "ActionType", dataType = eagleSvc.DataTypeEnum.S, value = "EXTRACT" };             taskParameters[1] = new eagleSvc.TaskParameter { name = "StreamName", dataType = eagleSvc.DataTypeEnum.S, value = "eagle_ml-2-0_default_out_q" };             taskParameters[2] = new eagleSvc.TaskParameter { name = "FeedType", dataType = eagleSvc.DataTypeEnum.S, value = "SMFEXTRACT" };             taskParameters[3] = new eagleSvc.TaskParameter { name = "fromdate", dataType = eagleSvc.DataTypeEnum.S, value = "2014-12-04 18-00-00" };             eagleML.taskParameters = taskParameters;             //set sync field to yes             eagleML.synchronousExecution = "yes";             runTaskRequest.EagleML = eagleML;             return runTaskRequest;         }

This method matches the method for an asynchronous request, only one parameter is added:

//set sync field to yes             eagleML.synchronousExecution = "yes";

The synchronousExecution field should be set to Yes to make a synchronous request.

Next, perform an EagleML call:

eagleSvc.WSTaskStatusResponse resExtract = myClient.RunTaskRequestSync(runTaskRequest);

The result of execution is a WS TaskStatusResponse object:

EagleML GenericSMF document is put under the EaglML/statusItem/reason/additionalData/string element as raw text.

To deserialize raw text to object we should create a getExtractObject method.

At first we get raw text and then we prepare an xmlSerializer, set necessary properties and overrides and execute the Deserialize method to create a SMF Generic EagleML document object.