A business process can be treated as service and can be made available to any application. The most interoperable way is to make it available as web service. Adeptia provides “WsProvider” to publish any business process as web service.
This post describes the method of publishing a business process as a web service.
1. Creating a process flow
2. Creating a security policy (optional)
3. Creating a ‘WsProvider’
You have a business process that takes the Auto Insurance Policy application and returns back the Policy Quote. You want to publish this process as a web service.
To publish the process as a web service, you need to design a process from perspective that it is similar to a function that takes input, processes it, and generates output. While designing, you need to remember:
- A Web service always takes input as XML data
- A Web service always generates output as XML data
You need to define both XML data formats, the one that the web service will take as input and the format that the web service will generate as output. You can do this using the Adeptia XML schema activity. You need to define input and output XML schemas.
Creating process flow
Based on function analogy a process flow will have four parts:
1. Defining input and output XML schemas
2. Getting input data from client request
3. Data processing logic
4. Sending output back as response to client
Defining Input and Output XML schema
You need to use Adeptia XML schema activity to define XML schemas for input and output. To do that you need to define:
- The XSD for the input XML. For example, in given scenario you have an Auto Insurance “Policy application” as an input whose XML schema is defined in Appendix A.
- The XSD for the output XML. For example, in given scenario the output generated is the “Policy Quote”.
Getting Input Data from Client Request
In the process flow you need to use “ContextSource” as activity. You need to define a “parameterName” in the “ContextSource” property. Web service client input data will be assigned to this parameter. The context source will read it from this “parameterName” and pass the data to any further activity for data processing. This is displayed in the Figure below.
Data Processing logic
The input data is then processed to generate a required output. The data processing logic can include data transformation activity and other Adeptia activity or group of activities. To process the input data, it will use input XML schema activity. It will use output XML schema activity to generate output data in XML format. The output generated after processing the input data is set in the Process flow context through “contextTarget”.
Sending Output back as response to client
In the process flow, you need to use “ContextTarget” as activity. You need to define a “parameterName”. Web service client output data will be assigned to this “parameterName”. The “ContextTarget” will take data from the data processing activity and assign to the “parameterName” defined above. This is displayed in the Figure below.