InvokeWebService vs InvokeWorkflow

I would like to know what the overhead is when calling a workflow nativly from a another workflow compared to call it as an exposed web service.

This would be valuable information when modelling workflows.


Answer this question

InvokeWebService vs InvokeWorkflow

  • SQL Pro

    In my project, InvokeWebService is too slow( especially invoking at the first time), so I have to use the InvokeWorkflow Activity, but it returned error message, as the following:

    System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: This operation can not be performed at runtime.
    at System.Workflow.ComponentModel.DependencyObject.SetValueCommon(DependencyProperty dependencyProperty, Object value, PropertyMetadata metadata, Boolean shouldCallSetValueOverrideIfExists)
    at System.Workflow.ComponentModel.DependencyObject.SetValue(DependencyProperty dependencyProperty, Object value)
    at System.Workflow.ComponentModel.WorkflowChanges.SetCondition(Object dependencyObject, Object value)
    at System.Workflow.Activities.StateMachineWorkflowActivity.set_DynamicUpdateCondition(ActivityCondition value)
    --- End of inner exception stack trace ---
    at System.Workflow.Activities.WorkflowWebService.Invoke(Type interfaceType, String methodName, Boolean isActivation, Object[] parameters)
    at SwiftMainWorkflow.MainWorkflow_WebService.Operation_SubmitToAudit(SwiftWorkflowContext context, SwiftWorkflowMessages& msg) in C:\Documents and Settings\zhuangyicheng\Local Settings\Temp\-a96swa6.cs:line 223
    --- End of inner exception stack trace ---

    The two workflow is in the same solution but in different project.


  • JimJams

    This is same issue as Remoting and WebServices. If you are creating a distributed application InvokeWebServices is the right activity. This will be even more appropriate with Indigo in place. However, if you are making a call from one Parent WF to child WF which lives with in the same assembly, InvokeWorkflow activity is the right choice.

    In old programming term, if you are making method call use InvokeWorkflow and if you are making a Remote Procedure Call (RPC) use InvokeWebService Activity.

  • Viborito

    InvokeWebService is going to end up going out on the network - or at least through sockets (if the workflow happened to be in the ASP.NET process).

    I wouldn't recommend that approach for speed - InvokeWorkflow is an inprocess call which would be much faster - but of course less extensible.

  • InvokeWebService vs InvokeWorkflow