views:

573

answers:

2

I'm not sure if im missing something obvious, with Windows Workflow used from within ASP.NET I don't really know how to get output from the Workflow back to the ASP.NET workflow.

I have my workflow setup to handle external event, so my web page can invoke it, which works fine, but how do I get the information out again? Do I have to query the Workflow object to find the information I want? This just seems wrong...What I thought I could do was use the CallExternalMethod in the workflow, but since there can only be one instance of the Workflow External Data service in the runtime, i'm not sure how it can be 'attached' to the individual pages?

All examples I have found seem to use the Page Workflow example in which the output from the workflow (when it calls CallExternalMethod) just calls the static redirect method. If for example I didnt want to redirect, but print the result from the workflow to the page, how do i 'capture' that information so it can be used in the page? (assuming that the runtime is called from a wrapper like the examples, so cant just do Label1.Text = bla since there is no access to that variable).

Edit: Or is it a matter of using the workflow to persist anything to the database and have the ASP.NET app qiery the given data from there (since instance GUID can be used as PK?)

+1  A: 

This link has information about passing information in and out of workflows:

http://books.google.com/books?id=s5eVXpNmQxgC&pg=PA32&dq=pro+windows+workflow+foundation#PPA241,M1

In respect to a web page:
The only difference to a webpage and the WinForm example in the link above is that you need to use the MaualWorkflowSchedulerService (this donates the thread the webpage used instead of making a new one for the workflow runtime).

So, say you are invoking the ExternalMethod in a button click with somthing like this (DataEvents being the service you add to the run time for your Handle / Call external methods):

    AddHandler DataEvents.DataReceived, AddressOf workflowEventsDataReceived    
    manualScheduler = WorkflowrunTime.GetService(GetType(Hosting.ManualWorkflowSchedulerService))
    DataEvents.OnGetDataReceived(New ExternalDataEventArgs(WorkflowInstance.InstanceId))
    manualScheduler.RunWorkflow(WorkflowInstance.InstanceId)

Then the method at workflowEventsDataReceived, which is the target of a CallExternalMethod inside the workflow (via the service you added to the WorkflowrunTime) will be able to update all the labels you want.

Not sure if any of that is clear, but let me know if need more help, was going through the same problem myself last weekend.

Cwoo
A: 

Hi,

But there is pass string message only.

I have a statemachine worklfow in my asp.net application.

My question is : i have list of login table entity which has the values( username,password)from my database. then how to pass that listEntity to callexternalmethod control. Then only i can able to pass that listEntity to UI. Otherwise any other alternate way to pass that listEntity to UI through any other control in workflow.

Dhanraj