2012-12-13 35 views
0

我有人問我們是否可以通過網絡服務向客戶提供文件。我們使用Scribe來發送數據到Web服務,但我無法發送附件。任何人都知道我是否可以用SSIS(或其他工具)做這樣的事情:我可以使用SSIS提交文件嗎

這是一種客戶端用來上傳purl更新的方法。這是一個以CSV格式上傳的單個文件,第一行是標題。 的方法需要五(5)參數:

Parameters (1) a string that is the login name. 
Parameters (2) a string that is used for the password. 
Parameters (3) a string that is used to specify which application. 
Parameters (4) a string that is the file name. This is used to identify a specific file upload. 
Parameters (5) an array of bytes that is the content of the file. 
Parameters (6) an integer that defines the length of the file upload. 
RETURNS an integer that will return the number of items successful uploaded or a negative number that returns an error. 
Sample: 
    // Connect to the Web Service 
    PurlService.ServiceFile  service = new PurlService.ServiceFile(); 
    // Test the method 
    string   login   = 「mylogin」; 
    string   password  = 「mypassword」; 
    string   application = 「FSI」; 
    string   filename  = 「myfilename.csv」; 
    byte []   bytes   = new byte[file.ContentLength]; 
    file.InputStream.Read(bytes, 0, file.ContentLength) 
    int    returnValue = service.UploadFile(login, password, application, fileName, bytes, bytes.Length); // If successful, the returnValue will be a text message. 

回答

1

SSIS提供了訪問.NET庫,所以如果你能在一個控制檯應用程序寫,你可以在SSIS做到這一點(我有一個SSIS包播放MP3只是爲了證明這一點)。 Script Task是您希望如何進行Web服務調用的方式。有一個內置的Web服務任務,但它是廢話。上面的代碼對於Web服務調用看起來依然正確,儘管我的所有代碼都是Windows驗證,所以我設置了不同的憑據。

工作流程方面,我希望你的包看起來像Data Flow來生成你的CSV提取,然後腳本任務調用你的Web服務,然後可能是一個文件任務歸檔CSV或執行SQL任務將表格中的傳輸細節記錄下來。

相關問題