using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Serialization;

namespace XMLExtractor.Services
{
    /// <summary>
    /// Summary description for XmlExtractorService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class XmlExtractorService : System.Web.Services.WebService
    {

        [WebMethod]
        public string ExtractorReadXML()
        {
            System.Web.Script.Serialization.JavaScriptSerializer s = new JavaScriptSerializer() ;
            Result result = new Result();
            result.message = "Success";
            result.value = 1;

            try
            {
                new ReadXML();
            }
            catch (Exception ex)
            {
                result.message = ex.Message;
                result.value = -1;
            }
            return s.Serialize(result);
        }
    }

    public struct Result
    {
        public string message;
        public int value;
    }
}
