locked
InvokeWebService Activity - SessionID Required Error RRS feed

  • Question

  • I am trying to use the InvokeWebService activity to export a SSRS report using the ReportingExecutionService. In order to do so I need to call three methods on the webservice:

     

    1. LoadReport
    2. SetExecutionParameters
    3. Render

    In code, I would create one instance of the service, pass the credentials once, and then call these three methods in succession. However, I am finding it extremely difficult using the InvokeWebService activities to do this. Here is the problem:

     

    I pass the credentials to the LoadReport on the Invoking event of the first InvokeWebService activity (LoadReport). That one runs fine, but now to call the SetExecutionParameters I need to Invoke the webservice yet again. However, since this is all in another activity, the service has no idea what report is loaded and tells me that the operation requires a valid sessionID. This makes sense, because you would think I would have to pass in the sessionID created by the first invocation of the service, but I have no idea how to do this.

     

    I tried this in the SetExecutionParameters Invoking handler:

     

    Activity2.SessionID = Activity1.SessionID

     

    But Activity1.sessionid = "" and it throws an exception telling me that I cannot do this at runtime. How can I pass the sessionID to the second and third invocation using InvokeWebService activities??

     

    Here is the error I get when trying to invoke the SetExecutionParameters method in my 2nd InvokeWebService activity:

     

    System.Web.Services.Protocols.SoapException: The session identifier is missing. A session identifier is required for this operation. ---> Microsoft.ReportingServices.Diagnostics.Utilities.MissingSessionIdException: The session identifier is missing. A session identifier is required for this operation.

    at Microsoft.ReportingServices.WebServer.SessionStarterAction.CreateExisting()

    at Microsoft.ReportingServices.WebServer.ReportExecution2005Impl.SetExecutionParameters(ParameterValue[] Parameters, String ParameterLanguage, ExecutionInfo& executionInfo)

     

    I have tried manually inserting a GUID into the SessionID property of the 2 InvokeWebService Activities on the page (I haven't even gotten to the third one yet, which would be Render), but I still get the same error.

     

     

    Thanks for any help.

    Wednesday, April 11, 2007 11:00 PM

Answers

  • With the sample here as a starting point do the following:

     

    ·         Add a new Workflow Console Application project to the solution, making sure the name is WorkflowConsoleApplication1.

    ·         Right click on the project in the solution explorer and choose Set as StartUp Project.

    ·         Add a web reference to the StateMachineWebServiceWorkflow_WebService web service that is in the project, make sure it is named localhost.

    ·         Delete the Workflow1.designer.cs file from the default workflow in the new project.

    ·         Replace the code in the remaining Workflow1.cs with the code below.

     

    using System;

    using System.Workflow.Activities;

     

    namespace WorkflowConsoleApplication1

    {

          public sealed partial class Workflow1: SequentialWorkflowActivity

          {

                public Workflow1()

                {

                      InitializeComponent();

            }

     

            #region Designer generated code

     

            /// <summary>

            /// Required method for Designer support - do not modify

            /// the contents of this method with the code editor.

            /// </summary>

            [System.Diagnostics.DebuggerNonUserCode]

            private void InitializeComponent()

            {

                this.CanModifyActivities = true;

                System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();

                System.Workflow.ComponentModel.WorkflowParameterBinding workflowparameterbinding1 = new System.Workflow.ComponentModel.WorkflowParameterBinding();

                System.Workflow.ComponentModel.ActivityBind activitybind2 = new System.Workflow.ComponentModel.ActivityBind();

                System.Workflow.ComponentModel.WorkflowParameterBinding workflowparameterbinding2 = new System.Workflow.ComponentModel.WorkflowParameterBinding();

                System.Workflow.ComponentModel.ActivityBind activitybind3 = new System.Workflow.ComponentModel.ActivityBind();

                System.Workflow.ComponentModel.WorkflowParameterBinding workflowparameterbinding3 = new System.Workflow.ComponentModel.WorkflowParameterBinding();

                System.Workflow.ComponentModel.ActivityBind activitybind4 = new System.Workflow.ComponentModel.ActivityBind();

                System.Workflow.ComponentModel.WorkflowParameterBinding workflowparameterbinding4 = new System.Workflow.ComponentModel.WorkflowParameterBinding();

                System.Workflow.ComponentModel.ActivityBind activitybind5 = new System.Workflow.ComponentModel.ActivityBind();

                System.Workflow.ComponentModel.WorkflowParameterBinding workflowparameterbinding5 = new System.Workflow.ComponentModel.WorkflowParameterBinding();

                System.Workflow.ComponentModel.ActivityBind activitybind6 = new System.Workflow.ComponentModel.ActivityBind();

                System.Workflow.ComponentModel.WorkflowParameterBinding workflowparameterbinding6 = new System.Workflow.ComponentModel.WorkflowParameterBinding();

                this.invokeWebServiceActivity3 = new System.Workflow.Activities.InvokeWebServiceActivity();

                this.invokeWebServiceActivity2 = new System.Workflow.Activities.InvokeWebServiceActivity();

                this.invokeWebServiceActivity1 = new System.Workflow.Activities.InvokeWebServiceActivity();

                //

                // invokeWebServiceActivity3

                //

                this.invokeWebServiceActivity3.MethodName = "ShipOrder";

                this.invokeWebServiceActivity3.Name = "invokeWebServiceActivity3";

                activitybind1.Name = "Workflow1";

                activitybind1.Path = "returnValue";

                workflowparameterbinding1.ParameterName = "(ReturnValue)";

                workflowparameterbinding1.SetBinding(System.Workflow.ComponentModel.WorkflowParameterBinding.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));

                activitybind2.Name = "Workflow1";

                activitybind2.Path = "id";

                workflowparameterbinding2.ParameterName = "id";

                workflowparameterbinding2.SetBinding(System.Workflow.ComponentModel.WorkflowParameterBinding.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));

                this.invokeWebServiceActivity3.ParameterBindings.Add(workflowparameterbinding1);

                this.invokeWebServiceActivity3.ParameterBindings.Add(workflowparameterbinding2);

                this.invokeWebServiceActivity3.ProxyClass = typeof(WorkflowConsoleApplication1.localhost.StateMachineWorkflow_WebService);

                this.invokeWebServiceActivity3.SessionId = "samesession";

                this.invokeWebServiceActivity3.Invoked += new System.EventHandler<System.Workflow.Activities.InvokeWebServiceEventArgs>(this.AfterCall);

                //

                // invokeWebServiceActivity2

                //

                this.invokeWebServiceActivity2.MethodName = "ProcessOrder";

                this.invokeWebServiceActivity2.Name = "invokeWebServiceActivity2";

                activitybind3.Name = "Workflow1";

                activitybind3.Path = "returnValue";

                workflowparameterbinding3.ParameterName = "(ReturnValue)";

                workflowparameterbinding3.SetBinding(System.Workflow.ComponentModel.WorkflowParameterBinding.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind3)));

                activitybind4.Name = "Workflow1";

                activitybind4.Path = "returnValue";

                workflowparameterbinding4.ParameterName = "id";

                workflowparameterbinding4.SetBinding(System.Workflow.ComponentModel.WorkflowParameterBinding.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind4)));

                this.invokeWebServiceActivity2.ParameterBindings.Add(workflowparameterbinding3);

                this.invokeWebServiceActivity2.ParameterBindings.Add(workflowparameterbinding4);

                this.invokeWebServiceActivity2.ProxyClass = typeof(WorkflowConsoleApplication1.localhost.StateMachineWorkflow_WebService);

                this.invokeWebServiceActivity2.SessionId = "samesession";

                this.invokeWebServiceActivity2.Invoked += new System.EventHandler<System.Workflow.Activities.InvokeWebServiceEventArgs>(this.AfterCall);

                //

                // invokeWebServiceActivity1

                //

                this.invokeWebServiceActivity1.MethodName = "CreateOrder";

                this.invokeWebServiceActivity1.Name = "invokeWebServiceActivity1";

                activitybind5.Name = "Workflow1";

                activitybind5.Path = "returnValue";

                workflowparameterbinding5.ParameterName = "(ReturnValue)";

                workflowparameterbinding5.SetBinding(System.Workflow.ComponentModel.WorkflowParameterBinding.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind5)));

                activitybind6.Name = "Workflow1";

                activitybind6.Path = "id";

                workflowparameterbinding6.ParameterName = "id";

                workflowparameterbinding6.SetBinding(System.Workflow.ComponentModel.WorkflowParameterBinding.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind6)));

                this.invokeWebServiceActivity1.ParameterBindings.Add(workflowparameterbinding5);

                this.invokeWebServiceActivity1.ParameterBindings.Add(workflowparameterbinding6);

                this.invokeWebServiceActivity1.ProxyClass = typeof(WorkflowConsoleApplication1.localhost.StateMachineWorkflow_WebService);

                this.invokeWebServiceActivity1.SessionId = "samesession";

                this.invokeWebServiceActivity1.Invoking += new System.EventHandler<System.Workflow.Activities.InvokeWebServiceEventArgs>(this.BeforeFirstCall);

                this.invokeWebServiceActivity1.Invoked += new System.EventHandler<System.Workflow.Activities.InvokeWebServiceEventArgs>(this.AfterCall);

                //

                // Workflow1

                //

                this.Activities.Add(this.invokeWebServiceActivity1);

                this.Activities.Add(this.invokeWebServiceActivity2);

                this.Activities.Add(this.invokeWebServiceActivity3);

                this.Name = "Workflow1";

                this.CanModifyActivities = false;

            }

     

            #endregion

     

            private InvokeWebServiceActivity invokeWebServiceActivity3;

            private InvokeWebServiceActivity invokeWebServiceActivity2;

            private InvokeWebServiceActivity invokeWebServiceActivity1;

     

            public String returnValue = default(System.String);

            public String id = default(System.String);

     

            private void BeforeFirstCall(object sender, InvokeWebServiceEventArgs e)

            {

                id = "13245";

            }

     

            private void AfterCall(object sender, InvokeWebServiceEventArgs e)

            {

                Console.WriteLine(returnValue);

            }

          }

    }

     

    Saturday, April 14, 2007 4:23 AM

All replies

  • In order for InvokeWebService activities to participate in same session, SessionId should be set to the same value at workflow design time.

     

    Activity1.SessionId = “MySession”;

    Activity2.SessionId = “MySession”;

     

    Basically the sessionId property is not storing an actual session data, but serves as identifier, specifying which invoke web service activities will share the web service session.

     

    Hope this helps.

    Thursday, April 12, 2007 11:32 PM
  • I tried that and it doesn't work, I know it is supposed to work because of what you say & the documentation of the InvokeWebService activity, but it doesn't. I entered the exact same guid for sessionID property of both activities at design time and still got the same error. I had to just use one InvokeWebService activity and grab the proxy on the Invoked handler to call the other two methods.
    Friday, April 13, 2007 10:09 PM
  • With the sample here as a starting point do the following:

     

    ·         Add a new Workflow Console Application project to the solution, making sure the name is WorkflowConsoleApplication1.

    ·         Right click on the project in the solution explorer and choose Set as StartUp Project.

    ·         Add a web reference to the StateMachineWebServiceWorkflow_WebService web service that is in the project, make sure it is named localhost.

    ·         Delete the Workflow1.designer.cs file from the default workflow in the new project.

    ·         Replace the code in the remaining Workflow1.cs with the code below.

     

    using System;

    using System.Workflow.Activities;

     

    namespace WorkflowConsoleApplication1

    {

          public sealed partial class Workflow1: SequentialWorkflowActivity

          {

                public Workflow1()

                {

                      InitializeComponent();

            }

     

            #region Designer generated code

     

            /// <summary>

            /// Required method for Designer support - do not modify

            /// the contents of this method with the code editor.

            /// </summary>

            [System.Diagnostics.DebuggerNonUserCode]

            private void InitializeComponent()

            {

                this.CanModifyActivities = true;

                System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();

                System.Workflow.ComponentModel.WorkflowParameterBinding workflowparameterbinding1 = new System.Workflow.ComponentModel.WorkflowParameterBinding();

                System.Workflow.ComponentModel.ActivityBind activitybind2 = new System.Workflow.ComponentModel.ActivityBind();

                System.Workflow.ComponentModel.WorkflowParameterBinding workflowparameterbinding2 = new System.Workflow.ComponentModel.WorkflowParameterBinding();

                System.Workflow.ComponentModel.ActivityBind activitybind3 = new System.Workflow.ComponentModel.ActivityBind();

                System.Workflow.ComponentModel.WorkflowParameterBinding workflowparameterbinding3 = new System.Workflow.ComponentModel.WorkflowParameterBinding();

                System.Workflow.ComponentModel.ActivityBind activitybind4 = new System.Workflow.ComponentModel.ActivityBind();

                System.Workflow.ComponentModel.WorkflowParameterBinding workflowparameterbinding4 = new System.Workflow.ComponentModel.WorkflowParameterBinding();

                System.Workflow.ComponentModel.ActivityBind activitybind5 = new System.Workflow.ComponentModel.ActivityBind();

                System.Workflow.ComponentModel.WorkflowParameterBinding workflowparameterbinding5 = new System.Workflow.ComponentModel.WorkflowParameterBinding();

                System.Workflow.ComponentModel.ActivityBind activitybind6 = new System.Workflow.ComponentModel.ActivityBind();

                System.Workflow.ComponentModel.WorkflowParameterBinding workflowparameterbinding6 = new System.Workflow.ComponentModel.WorkflowParameterBinding();

                this.invokeWebServiceActivity3 = new System.Workflow.Activities.InvokeWebServiceActivity();

                this.invokeWebServiceActivity2 = new System.Workflow.Activities.InvokeWebServiceActivity();

                this.invokeWebServiceActivity1 = new System.Workflow.Activities.InvokeWebServiceActivity();

                //

                // invokeWebServiceActivity3

                //

                this.invokeWebServiceActivity3.MethodName = "ShipOrder";

                this.invokeWebServiceActivity3.Name = "invokeWebServiceActivity3";

                activitybind1.Name = "Workflow1";

                activitybind1.Path = "returnValue";

                workflowparameterbinding1.ParameterName = "(ReturnValue)";

                workflowparameterbinding1.SetBinding(System.Workflow.ComponentModel.WorkflowParameterBinding.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));

                activitybind2.Name = "Workflow1";

                activitybind2.Path = "id";

                workflowparameterbinding2.ParameterName = "id";

                workflowparameterbinding2.SetBinding(System.Workflow.ComponentModel.WorkflowParameterBinding.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));

                this.invokeWebServiceActivity3.ParameterBindings.Add(workflowparameterbinding1);

                this.invokeWebServiceActivity3.ParameterBindings.Add(workflowparameterbinding2);

                this.invokeWebServiceActivity3.ProxyClass = typeof(WorkflowConsoleApplication1.localhost.StateMachineWorkflow_WebService);

                this.invokeWebServiceActivity3.SessionId = "samesession";

                this.invokeWebServiceActivity3.Invoked += new System.EventHandler<System.Workflow.Activities.InvokeWebServiceEventArgs>(this.AfterCall);

                //

                // invokeWebServiceActivity2

                //

                this.invokeWebServiceActivity2.MethodName = "ProcessOrder";

                this.invokeWebServiceActivity2.Name = "invokeWebServiceActivity2";

                activitybind3.Name = "Workflow1";

                activitybind3.Path = "returnValue";

                workflowparameterbinding3.ParameterName = "(ReturnValue)";

                workflowparameterbinding3.SetBinding(System.Workflow.ComponentModel.WorkflowParameterBinding.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind3)));

                activitybind4.Name = "Workflow1";

                activitybind4.Path = "returnValue";

                workflowparameterbinding4.ParameterName = "id";

                workflowparameterbinding4.SetBinding(System.Workflow.ComponentModel.WorkflowParameterBinding.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind4)));

                this.invokeWebServiceActivity2.ParameterBindings.Add(workflowparameterbinding3);

                this.invokeWebServiceActivity2.ParameterBindings.Add(workflowparameterbinding4);

                this.invokeWebServiceActivity2.ProxyClass = typeof(WorkflowConsoleApplication1.localhost.StateMachineWorkflow_WebService);

                this.invokeWebServiceActivity2.SessionId = "samesession";

                this.invokeWebServiceActivity2.Invoked += new System.EventHandler<System.Workflow.Activities.InvokeWebServiceEventArgs>(this.AfterCall);

                //

                // invokeWebServiceActivity1

                //

                this.invokeWebServiceActivity1.MethodName = "CreateOrder";

                this.invokeWebServiceActivity1.Name = "invokeWebServiceActivity1";

                activitybind5.Name = "Workflow1";

                activitybind5.Path = "returnValue";

                workflowparameterbinding5.ParameterName = "(ReturnValue)";

                workflowparameterbinding5.SetBinding(System.Workflow.ComponentModel.WorkflowParameterBinding.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind5)));

                activitybind6.Name = "Workflow1";

                activitybind6.Path = "id";

                workflowparameterbinding6.ParameterName = "id";

                workflowparameterbinding6.SetBinding(System.Workflow.ComponentModel.WorkflowParameterBinding.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind6)));

                this.invokeWebServiceActivity1.ParameterBindings.Add(workflowparameterbinding5);

                this.invokeWebServiceActivity1.ParameterBindings.Add(workflowparameterbinding6);

                this.invokeWebServiceActivity1.ProxyClass = typeof(WorkflowConsoleApplication1.localhost.StateMachineWorkflow_WebService);

                this.invokeWebServiceActivity1.SessionId = "samesession";

                this.invokeWebServiceActivity1.Invoking += new System.EventHandler<System.Workflow.Activities.InvokeWebServiceEventArgs>(this.BeforeFirstCall);

                this.invokeWebServiceActivity1.Invoked += new System.EventHandler<System.Workflow.Activities.InvokeWebServiceEventArgs>(this.AfterCall);

                //

                // Workflow1

                //

                this.Activities.Add(this.invokeWebServiceActivity1);

                this.Activities.Add(this.invokeWebServiceActivity2);

                this.Activities.Add(this.invokeWebServiceActivity3);

                this.Name = "Workflow1";

                this.CanModifyActivities = false;

            }

     

            #endregion

     

            private InvokeWebServiceActivity invokeWebServiceActivity3;

            private InvokeWebServiceActivity invokeWebServiceActivity2;

            private InvokeWebServiceActivity invokeWebServiceActivity1;

     

            public String returnValue = default(System.String);

            public String id = default(System.String);

     

            private void BeforeFirstCall(object sender, InvokeWebServiceEventArgs e)

            {

                id = "13245";

            }

     

            private void AfterCall(object sender, InvokeWebServiceEventArgs e)

            {

                Console.WriteLine(returnValue);

            }

          }

    }

     

    Saturday, April 14, 2007 4:23 AM
  • It's going to take me awhile to dig through and convert all that into vb.net. Thanks for the post and I hope it works.
    Monday, April 16, 2007 7:24 PM