Lee posted on May 2, 2009 10:36
Experiences with SSIS calling (yeech) Pervasive as a data source

 

I needed to create a web service to pass data from Pervasive to SAP, and completely bypass SQL Server.  Since I didn’t have the code handy and was too lazy to look on MSDN, I looked around on Google! … and found nothing to write home about. So, here’s my contribution in case you need to write one. Hope it helps someone looking to do same.

When building a web service to call an SSIS package (without touching a SQL Server and in my case calling Pervasive), I had to make a few adjustments that I probably wouldn’t have if we were only talking SQL Server. First, the ProtectionLevel had to be set with encrypt sensitive with password. I found that if I didn’t use this I would have the password default to blank as mentioned in help. Adding password to SSIS package configurations in a table didn’t work either – the password ‘*****’ really was ‘*****’.  So, inside of the web service, you have to use something what I have below. I first thought at first that package.password would work, but you must set the application password.

 
Application app = new Application();
app.PackagePassword = "sql"; 


You can also use the configuration in the project properties configuration tab to lock in the password:

 

image

 

This allows you to use the following to access the password:
 

package.PackagePassword = Properties.Settings.Default.pwd;


 
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();
        }
    }
}

 
 

Lee

 

-----------------------------

 

Thought for the day: “Compost Happens”


 

 

 

 


Posted in: .Net , SSIS  Tags:

Comments


May 2. 2009 10:59
Trackback from DotNetKicks.com

Web service calling an SSIS package

http://www.dotnetkicks.com/database/Web_service_calling_an_SSIS_packagehttp://www.dotnetkicks.com/database/Web_service_calling_an_SSIS_package


United States WFB
May 9. 2009 18:11
Do not use Pervasive but I am trying to call SSIS from a web service.  Did the following:
-- Created a C# Web Service project in VS 2008
-- Stripped in your above code.

Don't know how specific to Pervasive this is -- I think it needs refs to run as is.
Do you have samples or know links for the non-generic case?

no site


May 10. 2009 23:32
This example assumes that IIS is set up properly first (virtual directory, app pool, permissions, etc.). Also, VS 2008 and SQL Server 2008 IIS was used here. Make sure you have these set up first.

http://texastoo.com/http://texastoo.com/


June 29. 2009 23:41
Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon.

http://www.pedeee.com/sulumits-retsambewhttp://www.pedeee.com/sulumits-retsambew


Best of MSDN blogs - Calling a WCF web service from SSIS

Best of MSDN blogs - Calling a WCF web service from SSIS

http://www.texastoo.com/post/2010/07/08/Best-of-MSDN-blogs-Calling-a-WCF-web-service-from-SSIS.aspxhttp://www.texastoo.com/post/2010/07/08/Best-of-MSDN-blogs-Calling-a-WCF-web-service-from-SSIS.aspx

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading




by Lee Everest, M.S.

Search


Ads

Calendar

«  July 2010  »
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
View posts in large calendar

Tags

Disclaimer
The opinions, code, examples, et.al. expressed herein are my own personal opinions and do not represent my employer's view in any way, shape form, or fashion.  All code for demonstration purposes - no guarantees, either written or implied, are made.

© Copyright 2010 Lee Everest's SQL Server, etc. weblog