0

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

3
  • Can you explain this line Dts.Variables["User::IPSService"].Value = iPSService what's the value of iPSService ? and it's better to add some picture to have more visiblity of your problem Commented Feb 19, 2016 at 11:19
  • its a class of the webservice with the help of which you can access the webservice method. So I am basically creating an object of it to access the webservice methods. I am able to access the webservice method in the first script task. The problem happens when i try to pass this object to second script task. Commented Feb 19, 2016 at 11:22
  • @Tom what was your fix? I'm currently having the same issue trying to covert IOSPlus session create to IRESS, thanks! Commented Apr 13, 2023 at 2:18

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.