Ejemplo n.º 1
0
        static CreateUploadJobResponse createUploadJob(HttpRequestMessageProperty httpRequest, string JobType)
        {
            string txt = "";
            try
            {

                BulkDataExchangeServicePortClient client = new BulkDataExchangeServicePortClient(BDXconfigName);
                using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
                {

                    OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest);

                    //Create the request
                    CreateUploadJobRequest req = new CreateUploadJobRequest();

                    //Supply additional parameters
                    // The UUID must be unique.  Once used, you can't use it again
                    req.UUID = System.Guid.NewGuid().ToString();
                    req.uploadJobType = JobType;
                    req.fileType = FileType.XML;

                    //Get the response
                    CreateUploadJobResponse resp = client.createUploadJob(req);

                    if (resp.ack == BDX.AckValue.Success)
                    {
                        LMSMessage += Environment.NewLine + resp.timestamp + " :: " + JobType + " has been created with Job ID:" + resp.jobId + " and FileRefID: " + resp.fileReferenceId;
                        // log this to database
                    }
                    else
                    {
                        throw new Exception(resp.errorMessage[0].message);
                    }

                    return resp;

                }
            }
            catch (Exception ex)
            {
                LMSMessage += Environment.NewLine + " createUploadJob:" + ex.Message;
                CreateUploadJobResponse errResp = null;
                return errResp;
            }
        }
Ejemplo n.º 2
0
        private CreateUploadJobResponse createUploadJob(frmLMSMain sender, HttpRequestMessageProperty httpRequest, string JobType)
        {
            string txt = "";

                try
                {
                    sender.UploadStatus += "Calling createUploadJob\n";

                    BulkDataExchangeServicePortClient client = new BulkDataExchangeServicePortClient(BDXconfigName);
                    using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
                    {

                        OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest);

                        //Create the request
                        CreateUploadJobRequest req = new CreateUploadJobRequest();

                        //Supply additional parameters
                        // The UUID must be unique.  Once used, you can't use it again
                        req.UUID = System.Guid.NewGuid().ToString();
                        req.uploadJobType = JobType;
                        req.fileType = FileType.XML;

                        //Get the response
                        CreateUploadJobResponse resp = client.createUploadJob(req);

                        // update the status of the request (success / fail) and any messages returned
                        if (resp.errorMessage != null)
                        {
                            ErrorAdmin.updateResponseStatus(resp, sender, true);
                        }

                        if (resp.ack == BDX.AckValue.Success)
                        {
                            txt += resp.timestamp + " :: " + JobType + " has been created with Job ID:" + resp.jobId + " and FileRefID: " + resp.fileReferenceId;
                            Console.WriteLine(txt);
                            sender.UploadStatus += txt;
                        }

                        return resp;

                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    sender.UploadStatus += ex + "\n";
                    CreateUploadJobResponse errResp = null;
                    return errResp;
                }
        }