using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using Microsoft.SqlServer.Dts.Runtime;
namespace SAPPOC
{
/// <summary>
/// Summary description for WebServiceExample
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[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 WebServiceExample : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
public string POCDates(string StartDt, string EndDt, String packageName)
{
string pkg = @"\\yourservernamegoeshere" + packageName.ToString();
Application app = new Application();
Package package = app.LoadPackage(pkg, null);
package.PackagePassword = Properties.Settings.Default.pwd;
Variables vars = package.Variables;
vars["StartDt"].Value = StartDt;
vars["EndDt"].Value = EndDt;
DTSExecResult result = package.Execute();
if (result == DTSExecResult.Failure)
return result.ToString();
return "SSIS package executed successfully. You sent for start/end: " + StartDt.ToString() + " / " + EndDt.ToString();
}
}
}