Exemplo n.º 1
0
        private MovilizerWebService()
            : base()
        {
            this.Url  = MovilizerWebServiceConstants.GetWebServiceUrl();
            _inQueue  = new Queue();
            _outQueue = new Queue();

            _outTransaction = null;
            _requestAckKey  = null;

            // init parameter lists
            _moveletSets               = new List <MovilizerMoveletSet>();
            _moveletAssignments        = new List <MovilizerMoveletAssignment>();
            _moveletDeletes            = new List <MovilizerMoveletDelete>();
            _masterdataPoolUpdate      = new List <MovilizerMasterdataPoolUpdate>();
            _ParticipantReset          = new List <MovilizerParticipantReset>();
            _documentPoolUpdate        = new List <MovilizerDocumentPoolUpdate>();
            _moveletDeleteAssignments  = new List <MovilizerMoveletAssignmentDelete>();
            _ParticipantConfigurations = new List <MovilizerParticipantConfiguration>();
            _uploadDataContainers      = new List <MovilizerUploadDataContainer>();

            // pool templates
            _masterdataPoolUpdateTemplates = new Dictionary <string, object>();
            _documentPoolUpdateTemplates   = new Dictionary <string, object>();
        }
Exemplo n.º 2
0
        public MovilizerResponse PostMovilizerRequest(bool synchronousReponse = false, int numResponses = 1000, string requestTrackingKey = "")
        {
            this.Url = MovilizerWebServiceConstants.GetWebServiceUrl();
            // create request object
            MovilizerRequest request = this.ComposeRequest();

            request.synchronousResponse = synchronousReponse;
            request.numResponses        = numResponses;
            request.requestTrackingKey  = requestTrackingKey;

            string debugOutput = Configuration.GetDebugOutputPath();

            if (!String.IsNullOrEmpty(debugOutput))
            {
                XmlHelper.SerializeToFile(debugOutput + "MovilizerRequest.xml", request);
            }

            // consume web service
            MovilizerResponse response = null;
            int countdown = 3;

            while (response == null && countdown > 0)
            {
                try
                {
                    countdown--;
                    response = Movilizer(request);
                }
                catch (Exception e)
                {
                    LogFactory.WriteError(e.ToString());

                    if (countdown > 0)
                    {
                        // sleep for 10 seconds and try again
                        Thread.Sleep(10000);
                    }
                    else if (Configuration.ForceRequeingOnError())
                    {
                        // Requeue waiting message
                        LogFactory.WriteWarning("Error exceeded 3 consecutive retries, reqeuing messages for further processing.");

                        _moveletSets.AddRange(request.moveletSet);
                        _moveletAssignments.AddRange(request.moveletAssignment);
                        request.moveletDelete           = _moveletDeletes.ToArray();
                        request.masterdataPoolUpdate    = _masterdataPoolUpdate.ToArray();
                        request.moveletAssignmentDelete = _moveletDeleteAssignments.ToArray();
                        request.documentPoolUpdate      = _documentPoolUpdate.ToArray();
                        request.participantReset        = _ParticipantReset.ToArray();
                    }
                }
            }

            if (response != null)
            {
                this.EnqueueResponse(response);

                // log status messages
                MovilizerStatusMessage[] statusMessages = response.statusMessage;
                if (statusMessages != null)
                {
                    foreach (MovilizerStatusMessage statusMessage in statusMessages)
                    {
                        LogFactory.WriteEntry(statusMessage);
                    }
                }

                // log movelet errors
                MovilizerMoveletError[] moveletErrors = response.moveletError;
                if (moveletErrors != null)
                {
                    foreach (MovilizerMoveletError moveletError in moveletErrors)
                    {
                        LogFactory.WriteEntry(moveletError);
                    }
                }
            }

            return(response);
        }
Exemplo n.º 3
0
 public void ConfigureWebServiceForRequest()
 {
     this.Url     = MovilizerWebServiceConstants.GetWebServiceUrl();
     this.Proxy   = MovilizerWebServiceConstants.GetWebServiceProxy();
     this.Timeout = 300000; // 5 min
 }