有人问我是否可以通过 Web 服务向客户提供文件。我们经常使用 Scribe 向 Web 服务发送数据,但我无法发送附件。任何人都知道我是否可以使用 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.