HannesBiri

hi,

I want to implement a (at first) very simple workflow, that calls a number of methods in a sequence.

Example: An import-data workflow

- Call Data Check functionality (method of a class)

- Start Transaction

- Call Import Step 1

- Call Import Step 2

- Commit Transaction

This can be done very simple, using only the Code Activity. Here i create Instances of the classes and call the matching methods.

Another approach would be to use the "CallExternalMethod" Activity. Here much more work has to be done to get the scenario above running. Interfaces for all called methods have to be defined, The classes implemnting this methods must be serializable and added to the workflow runtime service a.s.o.

So i think, the easiert way to call some functions in a sequence via worklfow is using the code acitivity.

What are the drawbacks vs. what are the benefits from using the "CallExternalMethod" activity

When would you use/prefere "CallExternalMethod"

Regards,

Hannes Biribauer



Re: Windows Workflow Foundation Call methods sequentially - benefits of "CallExternalMethod"?


Re: Windows Workflow Foundation Call methods sequentially - benefits of "CallExternalMethod"?

HannesBiri

hi,

The response in the thread you linked was:

"...if you want your workflow to send data to the host application it should use CallExternalMethod to send the data through Local Data Exchange service in the workflow runtime. The call is synchronous."

hmmm - sending data to the host application also can be done without using "CallExternalMethod".

Methods, called from the Code Activity can have return values and send an operatoin result this way.

Example (Pseudocode):

Code Activity:

Class1 myClass = new Class1();

struct result = myClass.CheckData();

IfElseActivity (PseudoCode):

If (! result.ErrorCode.Equals(0))

throw new ApplicationException("Error checking data...");

next Code Activity:

Class 2 myNextClass = new Class2();

....

One benefit of using "CallExternalMethod" i can see - as the called methods must be marked as serializable, the workflow can be serialized while executing the external method. Is this the only benefit

regards,

Hannes





Re: Windows Workflow Foundation Call methods sequentially - benefits of "CallExternalMethod"?

Roman Kiss

Hannes,

- Workflow can communicate to the host application layer like another consumer of the service, remoting object, workflow, etc.

- Have a look at the Orcas Beta 1 (.Net Framework 3.5) - System.WorfklowServices for context driven Send/Receive Activities based on the WCF Technology

- also the sample Workflow Adapter/Connector Pair give you details about the design and implementation of the logical connectivity with workflow.

- The HEEA/CEMA is a pair of the tightly coupled communication activities to the host application, logical connected via Local Service Layer. The data contract must be declared as serializable, in order perform their cloning using the BinaryFormatter. Note, only the CEMA activity can handle initializing a correlated event.

Thanks

Roman






Re: Windows Workflow Foundation Call methods sequentially - benefits of "CallExternalMethod"?

HannesBiri

hello,

thx for your response.

I installed Orcas Beta 1 some days ago and saw that there are 2 new activities in the WF toolbox.

Since i have to implement workflow functionality in a current project that will go productive soon, i cannot use functinoality from .net 3.5 which is betta.

The link of the sample "Workflow Adapter/Connector Pair" is invalid (http:///).

ragards,

hannes





Re: Windows Workflow Foundation Call methods sequentially - benefits of "CallExternalMethod"?

Roman Kiss

- the Workflow Adapter/Connector Pair is located in the WF Gallery Samples.

Thanks

Roman