Turn: WF Workflow technology insider-call Workflow workflows (develop persistent workflows) through Web Services, wfworkflow
Turn: http://www.cnblogs.com/carysun/archive/2009/01/11/receiveactivity.html
If you have been responsible for developing an enterprise ERP system or an OA system, workflow is no stranger to you. A Workflow is an abstraction, generalization, and description of business rules between workflows and their operation steps. The main problem to be solved in a workflow is that, to achieve a certain business goal, documents, information, or tasks are automatically transmitted between multiple participants based on certain predefined rules using a computer. As you can see, Microsoft has released WF, WCF, WCS (authentication solution), and WPF (for the development performance Layer) on the basis of. NET 3.0 ). WF is the key to solving the core issues of enterprises. With WF, you can easily implement development according to the business logic, and then publish WF as a Web service, in this way, the communication between the client and the server is no longer affected by the development language, and the Web service can easily call WF for business operations.
The following uses a simple order entry system as an example to describe how to publish a Workflow as a Web service.
To implement a persistent workflow, use sqlcmd to create a local database, open the Command Prompt window, and enter
Sqlcom-S localhost/SQLEXPRRESS-E-Q "create database WorkflowPersistence"
Then open the folder
/Microsoft. Net/Framework/v3.0/Windows Workflow Foundation/SQL/[Lauguage]
There are 2 script files
SqlPersistenceService_Schema. SQL, SqlPersistenceService_Logic. SQL
Run this script file on the WorkflowPersistence database, and the database can be created successfully.
Instance Description: when the customer first joins an order, the Web service calls the Start method to create a new Workflow object instance. After that, the AddOrder method can be called multiple times to add a order. before the order is submitted, the workflow object instance is in a persistent state. When the server is idle, the relevant data of the Workflow object is stored in the WorkflowPersitence database. This can effectively reduce the pressure on the server cache. After the End method is called to submit an order, the Workflow object ends and the data of the Workflow object is deleted in the database.
Define an Order class first. Do not forget to add the Serializable attribute to the object.
[Serializable]
Public class Order
{...}
Develop an operation class OrderManager for Order, which includes a method AddOrder. Each time an Order is added, the method returns the ID of the newly added Order.
Public class OrderManager
{
Public int AddOrder (Order order)
{..........}
}
Now, for this instance, we first develop an interface IService_T1. The Start method indicates that the Workflow is started, and the End method indicates that the Workflow is finished.
Namespace Microsoft. IService
{
Public interface IService_T1
{
Void Start ();
Int AddOrder (Order order );
Void End ();
}
}
Is the complete view of this Workflow, we first use webServiceInputActivity1 to start the service
Set the IsActivating attribute of webServiceInputActivity1 to True, which means to activate this Workflow object instance and set InterfaceType to Microsoft. IService. IService_T1 and set MethodName to Start. When the client calls the Start method, the Workflow object instance is activated.
Then set the cycle condition (this. IsRepeated = true) of WhileActivity. this indicates that as long as the value of IsRepeated is True, WhileActivity can continue to run, the Workflow is in the persistent state.
Set two event-driven activities for listenActivity1. Add webServiceInputActivity2, codeActivity1, and webServiceOutputActivity1 to the event-driven activity on the left. Set InterfaceType of webServiceInputActivity2 to Microsoft. IService. IService_T1, set MethodName to AddOrder, and bind the Parameter order in the AddOrder Method to the parameter _ order in the Workflow object (refer to the complete code). In this way, the AddOrder method can be mobilized through webServiceInputActivity2. Then add the operation code to the codeActivity_ExecuteCode method of codeActivity.
Finally, end the operation through webServiceOutputActivity1, set the InputActivityName attribute to webServiceInputActivity2, and bind the ReturnValue to the variable id. In this way, the system can obtain the return value (int) id of the AddOrder method after inserting Order.
Now, you can insert a webServiceInputActivity3 In the event-driven activity on the right and set InterfaceType to Microsoft. IService. IService_T1, set MethodName to End, and then add the InputReceived event processing method webServiceInputActivity3_InputReceived. In this way, set the IsRepeate attribute to false, so that this activity can be mobilized to finally loop, end the workflow.
This is the complete code of the Workflow:
Namespace Microsoft. Workflows
{
Public sealed partial class Workflow: SequentialWorkflowActivity
{
Public Order _ order;
Public int id;
Public bool IsRepeate = true;
Public Workflow2 ()
{
InitializeComponent ();
}
// Execute this operation when the AddOrder method is called, insert order through the orderManager object, and assign the value of orderID to the Workflow parameter id.
Private void codeactivityappsexecutecode (object sender, EventArgs e)
{
OrderManager orderManager = new OrderManager ();
Int orderID = orderManager. AddOrder (order );
This. id = orderID;
}
// When the webServiceInputActivity3 activity is called, set IsRepeate to false to terminate the loop to bundle the workflow object.
Private void webServiceInputActivity3_InputReceived (object sender, EventArgs e)
{
IsRepeate = false;
}
}
}
Right-click the "project" and select "publish this Workflow as Web". The following ASMX file is displayed:
Microsoft. Workflows. Workflow2_WebService.asmx
<% @ WebService class = "Microsoft. Workflows. Workflow2_WebService" %>
Add configuration file
<? Xml version = "1.0"?>
<Configuration>
<ConfigSections>
<Section name = "WorkflowRuntime" type = "System. Workflow. Runtime. Configuration. WorkflowRuntimeSection, System. Workflow. Runtime, Version = 3.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35"/>
</ConfigSections>
<WorkflowRuntime Name = "WorkflowServiceContainer">
<Services>
<Add type = "System. Workflow. Runtime. Hosting. ManualWorkflowSchedulerService, System. Workflow. Runtime, Version = 3.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35"/>
<Add type = "System. Workflow. Runtime. Hosting. DefaultWorkflowCommitWorkBatchService, System. Workflow. Runtime, Version = 3.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35"/>
<Add type = "System. workflow. runtime. hosting. sqlWorkflowPersistenceService, System. workflow. runtime, Version = 3.0.0.0, Culture = neutral, PublicKeyToken = token "UnloadOnIdle =" true "LoadIntervalSeconds =" 5 "ConnectionString =" Data Source = LESLIE-PC; Initial Catalog = WorkflowPersistence; integrated Security = True "/>
// Here is to add the sqldatabase persistence service for Workflow, because this configuration is required if the Workflow is tested for persistence.
</Services>
</WorkflowRuntime>
<AppSettings/>
<ConnectionStrings/>
<System. web>
<Compilation debug = "true"/>
<Authentication mode = "Windows"/>
<HttpModules>
<Add type = "System. Workflow. Runtime. Hosting. WorkflowWebHostingModule, System. Workflow. Runtime, Version = 3.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35" name = "WorkflowHost"/>
</HttpModules>
</System. web>
</Configuration>
Call the Start method to Start Workflow, and then you can directly call the AddOrder method. What is different from the previous instance is that in the previous example, each instance can only be called once, when the page is not reloaded, an error message is displayed when it is called multiple times. In this example, AddOrder can be called multiple times and run properly. This proves that the Instance Object of the Workflow you call has already been a persistent Workflow, when you do not call End to End the service, this workflow object can all be running.
Finally, you can call the End method to End the operation. After the operation is completed, call AddOrder. The system will display an error:
System. InvalidOperationException: The workflow with the ID "3a8b9688-fb3f-4a10-bb84-6bf99c30119a" cannot be found in the state persistence storage.
To sum up, with the development of persistent service streams, you can maintain the activity status of the workflow instance, so that you can call each other through multiple Web Services. Using this technology to implement workflow-based applications, you can publish them through the Web service client and maintain the working state.
Web services and WF can be called each other. In these two chapters, we will introduce how to publish a workflow as a Web service, the next chapter describes how to call Web Services in WF through InvokeWebServiceWorkflow.
If you are interested in NET system development, join the QQ group: 59557329 of the net Technology Development Alliance for discussion.
WF Workflow technology insider-call Workflow (Basic instance) through Web Services)
WF Workflow technology insider-call a Workflow through a Web Service (develop a persistent Workflow)
WF Workflow technical insider-use InvokeWebServiceActivity to call Web Services in a Workflow
WF workflow technology insider-Mutual calling between WF and WCF (publishing WF as WCF using ReceiveActivity)
Develop a WEB visual workflow management system using OSWorkflow
We recommend that you use FLEX to develop a workflow designer. In addition, the OSUSER user system of OSWORKFLOW is too junk. It is a zombie. If you are lucky enough to use it for a long time, rewrite OSWORKFLOW to your favorite type.
A survey on the application of workflow management Software
Workflow is "automation of part of the business process or the whole in the computer application environment ", it mainly solves the problem of "automatically transferring documents, information or tasks among multiple participants according to certain predefined rules, so as to achieve a certain expected business goal, or ".
Simply put, a workflow is a series of interconnected and automatic business activities or tasks. A workflow includes a group of tasks (or activities) and their ordered relationships. It also includes the conditions for starting and ending processes and tasks (or activities), and for each task (or activity).
In most practical applications, workflows can be described as follows: on the hardware platform of networks, servers, and multiple computer clients, the business process is completed based on preset rules and related data is processed by applications and people. For example, in daily work, a report may need to be submitted to the lead for review or instruction. The approval comments may need to be collected and submitted to another person, to further modify the report. In this way, the same document may be transmitted between multiple people in sequence or at the same time. In this case, we can use the workflow technology to control and manage the automatic transfer of documents between computers, rather than manual transfer. This can be called a workflow.
Similar automatic processing of documents is only a simple application of workflow technology. In fact, workflow technology can accomplish more and more complex tasks in real life. Such as automatic processing of various data or information within an enterprise (or institution), integration of multiple business processes, and data exchange between enterprises (or institutions, the Internet technology enables cross-region data transmission and processing.
Workflow for selling a product:
I. workflow development
Workflow technology originated from the research in the office automation field in the middle of 1970s. At that time, due to the lack of computer technology, low level of network technology, and lack of theoretical foundation, this new technology was not successful. From 1983 to 1985, there were early commercial systems with workflow features in the field of image processing and email.
After the 1990s s, with the popularization and popularization of personal computer and network technologies and the increasingly sophisticated information construction, the research and development of workflow technology has entered a new upsurge. In August 1993, the Workflow Management Coalition (WFMC), the first Industrial Organization for Standardization of Workflow technology, was established. In 1994, the workflow management Alliance released a reference model for workflow interoperability between workflow management systems and successively formulated a series of industrial standards. At the same time, academic research on workflow technology is also very active, and many prototype systems are developed in the laboratory. Since the 21st Century, workflow technology has been recognized by more and more people, and standards, workflow engines, and commercial products related to it are numerous. While developing and promoting workflow products, people pay more attention to the theoretical research of workflow to promote the maturity of this technology.
Ii. Features of workflows
1. Graphic and visual design Flowchart
2. Support various complex processes
3. Designated functions of the organizational structure Processor
4. B/S structure, pure Browser Application
5. Powerful security features
6. Powerful form functions and convenient Extension
7. Flexible out-of-office and timeout management policies
8. process tracking and management
9. Rich statistics, query, and report functions
10. Integration with the MAIL system
Iii. Advantages of workflows
The benefits of implementing workflow management in enterprises are obvious, this includes improving enterprise operation efficiency, improving enterprise resource utilization, improving enterprise operation flexibility and adaptability, improving work efficiency, concentrating on core businesses, tracking business processing processes, and quantifying and assessing business processing. efficiency, reduce waste, increase profits, and make full use of existing computer network resources. Implementing workflows will shorten the enterprise operation cycle, improve internal and external processes, optimize and rationally use resources, reduce human errors and delays, and improve labor productivity ...... remaining full text>