다음을 통해 공유


HttpClientConnection.DownloadFile Method

Downloads data from the resource specified by ServerURL property to a local file.

네임스페이스: Microsoft.SqlServer.Dts.Runtime
어셈블리: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

구문

‘선언
Public Sub DownloadFile ( _
    fileName As String, _
    OverwriteDestination As Boolean _
)
public void DownloadFile (
    string fileName,
    bool OverwriteDestination
)
public:
void DownloadFile (
    String^ fileName, 
    bool OverwriteDestination
)
public void DownloadFile (
    String fileName, 
    boolean OverwriteDestination
)
public function DownloadFile (
    fileName : String, 
    OverwriteDestination : boolean
)

매개 변수

  • fileName
    The name of the local file into which the downloaded data is stored.
  • OverwriteDestination
    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 require replacment 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;
const String svcName = "Test_WebService"
Dim wsdlFile As String =  Directory.GetCurrentDirectory() + "\WebSvceTask_wsdl.wsdl" 
 
'create HTTP connection
Dim httpConn As ConnectionManager =  pkg.Connections.Add("HTTP") 
Dim clientConn As HttpClientConnection =  New HttpClientConnection(httpConn.AcquireConnection(Nothing)) 
clientConn.UseProxy = True
clientConn.ProxyURL = "http://yourproxy"
clientConn.BypassProxyOnLocal = True
clientConn.ServerURL = yourURL
 
Dim th As TaskHost = CType(pkg.Executables.Add("STOCK:WebServiceTask"), TaskHost)
Dim task As WebServiceTask = CType(th.InnerObject, WebServiceTask)
 
task.Connection = httpConn.Name
task.ServiceName = svcName
task.OutputType = DTSOutputType.Variable
task.OutputLocation = "output"
 
clientConn.DownloadFile(wsdlFile, False)
task.WsdlFile = wsdlFile

스레드 보안

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

플랫폼

개발 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

대상 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

HttpClientConnection Class
HttpClientConnection Members
Microsoft.SqlServer.Dts.Runtime Namespace