Ejemplo n.º 1
0
        /// <summary>
        /// NotifyDocument11
        /// </summary>
        /// <returns></returns>
        public string NotifyDocument11(string nodeEndpoint, string flow, string name, CommonContentType type, string content)
        {
            string transactionId =
                _requestor.Notify(Authenticate(), nodeEndpoint, flow, name,
                                  CommonContentAndFormatProvider.ConvertTo11Enum(type),
                                  content);

            return(transactionId);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Download
        /// </summary>
        /// <param name="securityToken"></param>
        /// <param name="transactionId"></param>
        /// <param name="dataflow"></param>
        /// <param name="documents"></param>
        void INetworkNodeBinding.Download(string securityToken, string transactionId, string dataflow, ref NodeDocument[] documents)
        {
            Init();
            LOG.Debug("Download");

            if (string.IsNullOrEmpty(transactionId))
            {
                throw _service11Provider.FaultProvider.GetFault(EndpointVersionType.EN11, ENExceptionCodeType.E_InvalidParameter,
                                                                "NULL Transaction Id");
            }

            try
            {
                SoapContext res = HttpSoapContext.ResponseContext;

                LOG.Debug("Getting visit");
                NamedEndpointVisit visit = _service11Provider.VisitProvider.GetVisit(securityToken);

                ComplexContent content = new ComplexContent();
                if (!string.IsNullOrEmpty(dataflow))
                {
                    content.Flow = new OperationDataFlow(dataflow);
                }
                content.Transaction = new SimpleId(transactionId);

                LOG.Debug("Submitting: " + content);
                IList <Document> wnosDocs = _service11Provider.ContentService.Download(content, visit);


                List <NodeDocument> wsdlDocList = new List <NodeDocument>();

                if (!CollectionUtils.IsNullOrEmpty(wnosDocs))
                {
                    Dictionary <string, string> docIdList = new Dictionary <string, string>();

                    LOG.Debug("Spooling documents");
                    foreach (Document wnosDoc in wnosDocs)
                    {
                        NodeDocument doc = new NodeDocument();

                        doc.content = wnosDoc.Content;
                        doc.type    = CommonContentAndFormatProvider.ConvertTo11Enum(wnosDoc.Type);
                        doc.name    = wnosDoc.DocumentName;
                        LOG.Debug("   doc:" + doc);

                        DimeAttachment attachment = new DimeAttachment();
                        attachment.Stream     = new MemoryStream(doc.content);
                        attachment.TypeFormat = TypeFormatEnum.MediaType;
                        attachment.Type       = "application/x-gzip";
                        attachment.Id         = Guid.NewGuid().ToString();

                        //Add to the the xref filter collection
                        docIdList.Add(doc.name, attachment.Id);

                        res.Attachments.Add(attachment);
                        wsdlDocList.Add(doc);
                    }
                    //Output filter specific
                    res.Add("hrefs", docIdList);
                }

                documents = wsdlDocList.ToArray();
            }
            catch (Exception ex)
            {
                LOG.Error("Error while downloading", ex);
                throw _service11Provider.FaultProvider.GetFault(EndpointVersionType.EN11, ex);
            }
        }