SSIS : Error while passing the webservice object f

2019-09-03 01:15发布

问题:

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 my connection , 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

  1. Create a package level variable IPSService of the type object
  2. Create a webservice reference
  3. Add the using statement that is using ST_d4beade8c14e45c3af4e582df4c22c89.csproj.uk.co.iress.webservices; (Got the reference from the object browser)
  4. Create in the instance of the service in the script task
  5. Assign the object to Dts.Variables["User::IPSService"].Value = iPSService;
  6. Set the ReadWrite variables in the script properties to User::IPSService.

In Second script task , I do the following

  1. Set the readonly variable property of the script task to User::IPSService
  2. Create a webservice reference
  3. Add the using statement that is using ST_d4beade8c14e45c3af4e582df4c22c89.csproj.uk.co.iress.webservices; (Got the reference from the object browser)
  4. In the main method , IPSService iPSService1 = (IPSService)Dts.Variables["User::IPSService"].Value;

However when i run the tasks , I get the following error

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()

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

回答1:

This has been fixed. There were some header information that was missed while making a call to the webservice.



标签: ssis