问题描述
我有两个引用 Web 服务的脚本任务.两个脚本任务都引用了同一个 web 服务.一旦我创建了网络服务的实例并建立了我的connection ,我想将相同的实例传递给下一个脚本任务,因为我需要进行另一个 webservice 调用.
I have two script tasks that reference a webservice. Both the script tasks are referncing to the same webservice. Once I have created the instance of the webservice and established myconnection , i want to pass the same instance to the next script task as I need to make another webservice call.
为了在我的第一个任务中实现这一目标,我执行以下操作
To achieve that in my first task , I do the following
- 创建一个对象类型的包级变量IPSService
- 创建网络服务引用
- 添加使用 ST_d4beade8c14e45c3af4e582df4c22c89.csproj.uk.co.iress.webservices 的 using 语句;(从对象浏览器获得引用)
- 在脚本任务中的服务实例中创建
- 将对象分配给 Dts.Variables["User::IPSService"].Value = iPSService;
- 将脚本属性中的 ReadWrite 变量设置为 User::IPSService.
在第二个脚本任务中,我执行以下操作
In Second script task , I do the following
- 将脚本任务的只读变量属性设置为 User::IPSService
- 创建网络服务引用
- 添加使用 ST_d4beade8c14e45c3af4e582df4c22c89.csproj.uk.co.iress.webservices 的 using 语句;(从对象浏览器获得引用)
- 在主方法中,IPSService iPSService1 = (IPSService)Dts.Variables["User::IPSService"].Value;
但是,当我运行任务时,出现以下错误
However when i run the tasks , I get the following error
错误:System.Reflection.TargetInvocationException:调用的目标已抛出异常.---> System.InvalidCastException: 无法将类型为ST_d4beade8c14e45c3af4e582df4c22c89.csproj.uk.co.iress.webservices.IPSService"的对象转换为类型ST_d4beade8c14e45c3af4e582ips.c3af4e582c89.csproj.uk.co.iress.webservices.IPSService"在 ST_d4beade8c14e45c3af4e582df4c22c89.csproj.ScriptMain.Main()
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Unable to cast object of type 'ST_d4beade8c14e45c3af4e582df4c22c89.csproj.uk.co.iress.webservices.IPSService' to type 'ST_d4beade8c14e45c3af4e582df4c22c89.csproj.uk.co.iress.webservices.IPSService'. at ST_d4beade8c14e45c3af4e582df4c22c89.csproj.ScriptMain.Main()
我只是做了一个小改动,以避免传递对象并在第二个脚本方法中重新创建对象,但我收到一个新错误错误:System.Reflection.TargetInvocationException:调用目标已抛出异常.---> System.Web.Services.Protocols.SoapException: 无效的 SDO 主题 TD_ERROR.
I just did a small change to avoid passing the object and recreate the object in the second script method but i get a new error Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Web.Services.Protocols.SoapException: Invalid SDO Topic TD_ERROR.
谁能告诉我这是什么问题
Can anybody tell me what the problem is
推荐答案
此问题已修复.调用网络服务时遗漏了一些标头信息.
This has been fixed. There were some header information that was missed while making a call to the webservice.
这篇关于SSIS:将 webservice 对象从一个脚本任务传递到另一个时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!