SSIS Package to Call Web Service

SSIS调用Web服务
本文介绍如何使用SSIS包调用Web服务并传递数据。通过创建包含特定功能的Web服务,利用SSIS进行数据交互,并将结果写入文件。

原文 SSIS Package to Call Web Service

SSIS Package to Call Web Service.

You can Call WebService from SSIS package and transfers your data.

First of all you have to create web service with function as  you needed to call.

Step1 : Go To Microsoft Visual Studio –> New –> WebSite –> ASP.Net WebService and provide you web service name.

WebService 1

Step2 : Paste below code to your Service1.asmx.vb file.

I have created new function “MyHelloWorld” with parameter name in which i am passing a string to write in a destination file.

1Imports System.Web.Services
2Imports System.Web.Services.Protocols
3Imports System.ComponentModel
4 
5' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
6' <System.Web.Script.Services.ScriptService()> _
7<System.Web.Services.WebService(Namespace:="<a href="http://tempuri.org/">http://tempuri.org/</a>")> _
8<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
9<ToolboxItem(False)> _
10Public Class Service1
11    Inherits System.Web.Services.WebService
12    <WebMethod()> _
13    Public Function MyHelloWorld(ByVal name) As String
14        Dim FILE_NAME As String = "E:\WebServiceTextFromService.txt"
15        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
16 
17        objWriter.Write(name)
18        objWriter.Close()
19        Return "Process Completed."
20    End Function
21 
22End Class

Step3 : Now Create New SSIS Package with your desired name.

Drag Weservice Task to Control Flow.

Create one variable “Result” with datatype string and value “I am writting this content to file by web service task”.

WebService 2

Step4 : Create one http connection manager. i am using 61508 port number for my local web service so my Server URL :http://localhost:61508.

This port number is assigned by default, you can change port number from web service property.

WebService 4

Step5 : Create one file connection to write output result to local path.

WebService 8

Step6 :  Right click on Web Service Task –> Edit.

On General Tab Select HTTP Connection Manger which you have created on Step4.

Select your WSDL file path to WSDLFile field.

WebService 5

Step7 : Select Input path of Web Service Task Editor.

Select your service name in Service and Method “MyHelloWorld” which you have created on Step2.

After selecting Method, Parameter field enables automatically.

Click on Variable checkbox and select User::Result in value .

WebService 6

Step8 : Select OutPut tab on left pane on Web Service Task Editor.

Select Flat File Connection “WebServiceText.txt” in File Field.

WebService 7

Step9 : After completing this build and run the project and you will get file will be created on “D:\WebServiceText.txt”

with the content “I am writting this content to file by web service task”.

 

Regards,

Nirav Gajjar

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值