Question : Consuming a web service, importing the consumed xls file into a sql server database table

I am very new to web services and I have to work on the following:

I am provided a web service url. When I run this url on a browser, I see a popup that asks about either opening or saving a Microsoft Excel file. When I select open or save option, it appropriately opens or saves the xls file on my hard drive. I want to consume this web service and import this xls file into a table in the SQL Server database. Can you please help me step by step i.e.
(1) How to consume the web service and receive the Excel file through my web service
(2) Import the data in the xls file using c#.NET into a table in the SQL Server database

Please help.

Answer : Consuming a web service, importing the consumed xls file into a sql server database table

If you mean SSIS, then it is possible to create something that downloads a file, even though there isn't a specific task for that.

Downloading a file over HTTP the SSIS way
http://www.sqlis.com/post/Downloading-a-file-over-HTTP-the-SSIS-way.aspx

If this question was representative of driving in a car, we would be swerving all over the place *BIG GRIN*.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
Imports System
Imports System.IO
Imports System.Text
Imports System.Windows.Forms
Imports Microsoft.SqlServer.Dts.Runtime

Public Class ScriptMain

    Public Sub Main()

        ' Get the unmanaged connection object, from the connection manager called "HTTP Connection Manager"
        Dim nativeObject As Object = Dts.Connections("HTTP Connection Manager").AcquireConnection(Nothing)

        ' Create a new HTTP client connection
        Dim connection As New HttpClientConnection(nativeObject)


        ' Download the file #1
        ' Save the file from the connection manager to the local path specified
        Dim filename As String = "C:\Temp\Sample.txt"
        connection.DownloadFile(filename, True)

        ' Confirm file is there
        If File.Exists(filename) Then
            MessageBox.Show(String.Format("File {0} has been downloaded.", filename))
        End If


        ' Download the file #2
        ' Read the text file straight into memory
        Dim buffer As Byte() = connection.DownloadData()
        Dim data As String = Encoding.ASCII.GetString(buffer)

        ' Display the file contents
        MessageBox.Show(data)


        Dts.TaskResult = Dts.Results.Success
    End Sub

End Class
Random Solutions  
 
programming4us programming4us