Esempio n. 1
0
        public Stream TransformToX12(Stream postData)
        {
            string resp   = string.Empty;
            var    parser = new OopFactory.X12.Parsing.X12Parser();

            try {
                var xmltext = new StreamReader(postData, Encoding.UTF8).ReadToEnd();
                resp = parser.TransformToX12(xmltext);
            } catch (Exception e) {
                WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.BadRequest;
                resp = e.Message;
            }

            WebOperationContext.Current.OutgoingResponse.ContentType = "text/plain";
            Stream           stream        = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(resp));
            OperationContext clientContext = OperationContext.Current;

            clientContext.OperationCompleted += new EventHandler((o, s) => {
                if (stream != null)
                {
                    stream.Dispose();
                }
            });

            return(stream);
        }
Esempio n. 2
0
        public void ConvertStdIn()
        {
            var parser = new OopFactory.X12.Parsing.X12Parser();

            var xml = Console.In.ReadToEnd();

            Console.Out.Write(parser.TransformToX12(xml));
        }