HttpClientConnection.DownloadFile Method
Downloads data from the resource specified by ServerURL property to a local file.
Namespace: Microsoft.SqlServer.Dts.Runtime
Assembly: Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)
Parameters
- fileName
- Type: System.String
The name of the local file into which the downloaded data is stored.
- OverwriteDestination
- Type: System.Boolean
A Boolean that indicates whether to overwrite an existing file, if found. A value of true will overwrite the existing file.
The following code example shows the creation of an HttpClientConnection, sets appropriate values for the download, then calls DownloadFile. The value of the properties requires replacement with values that are valid for your application.
const string svcName = "Test_WebService"; string wsdlFile = Directory.GetCurrentDirectory() + @"\WebSvceTask_wsdl.wsdl"; //create HTTP connection ConnectionManager httpConn = pkg.Connections.Add("HTTP"); HttpClientConnection clientConn = new HttpClientConnection(httpConn.AcquireConnection(null)); clientConn.UseProxy = true; clientConn.ProxyURL = @"http://yourproxy"; clientConn.BypassProxyOnLocal = true; clientConn.ServerURL = yourURL; TaskHost th = (TaskHost)pkg.Executables.Add ("STOCK:WebServiceTask"); WebServiceTask task = (WebServiceTask)th.InnerObject ; task.Connection = httpConn.Name; task.ServiceName = svcName; task.OutputType = DTSOutputType.Variable; task.OutputLocation = "output"; clientConn.DownloadFile(wsdlFile, false); task.WsdlFile = wsdlFile;