WF Services introduce few new bindings which slightly change the communication protocol between client and service.
This post contains one full message exchange example of the statemachine-workflow which provide
two operations: GetData and OnNewMessage.
The first operation starts the workflow and the second one should fire event in the
statemachine-workflow.Following picture shows the statemachine-workflow service and
pictures below show the initial state initiated by invoking of operation GetData()
and the state OnNextMessage which is triggered by invoking of
the operation OnNextMessage() respectively.
- Workflow used in this example -
- Initial Worflow State which is activated by invoking of GetData() -
- Behind of OnNextMessage state which is activated by invoking of OnNextMessage()-
This is the code which starts the workflow:
Following message is sent from client to service while invoking the operation string GetData(int):
After invoking of this operation the response is returned back. However this response
contains the cookie value which describes the workflow context:
This value is required by each next operation invocation to identify the workflow
instance which will receive the message. The first message above has not
workflow context value, because the workflow does not exist at the moment
of invocation. After the workflow instance is created the workflow context is retrieved.
The retrieved value uniquely identifies the workflow instance.
In the next example we invoke the second operation (OnNextMessage) on the same client
proxy instance.
This call produces following message sent form the client to the service:
As we see, the workflow context identifier is appended in the web-header. This value will be used
on the service side to identify the target WF instance and to invoke the operation
OnNextMessage on that instance. Here is the response of invocation:
Note that this response does not contain the context identifier value header "WscContext".
Posted
Mar 07 2008, 10:10 PM
by
Damir Dobric