Workflows in the SOAP calls
The following picture represents how the SOAP calls can be implemented using workflow inProcess functionality:
The structure of the Request and response is presented in the image below.
Soap layer remains unchanged for all soap calls and each type of soap calls is associated with the correspondent inProcess workflow.
RequestDTO contains the hookpointKey which identifies the associated workflow and array of ValueDTO objects. Each ValueDTO object contains the KEY and VALUE. Depending on the subclass used, VALUE can be long, String, double, Data or array of ValueDTO objects.
Soap layer transforms the array of ValueDTO objects into the hash table of context objects with the correspondent keys, provided in the request and starts the workflow with the hookpointKey provided in the request.
After the workflow is executed, hash table with the result objects is passed back to the SOAP layer, which performs the transformation of the result hash table to ResponseDTO object, which is returned as result of the SOAP call.
Requirements for the workflow:
1. Workflows started by the SOAP method should contain only inProcess activities, and be completely executed by the Tomcat, since SOAP methods are synchronous and should return the result with in relatively short period of time.
2. Hash table which is returned as the result of the workflow execution must contain only values of type long, double, String, Date or Hashtable.
3. Hash table which is returned as the result of the workflow execution must contain the values with the following keys used in the ResponseDTO to identify the status of the SOAP call: STATUS, ERROR_LEVEL, ERROR_MESSAGE.
4. In most of the cases SOAP calls are used as a part of direct user interaction so the response time should be fast, which means embedded inProcess workflow should be executed within the corresponding time frames.
Validation XMLs
mandatory - element is mandatory in the request if this attribute = "true"
key - key of the element
type - type of the element (possible values:
c - ComplexValueDTO
s - StringValueDTO
b - BooleanValueDTO
d - DateValueDTO
f - DoubleValueDTO
l - LongValueDTO)
regexp - regular expression, which could be used to validate string input parameters
desc - description, used for generating the documentation from XML. If it is missing, description in documentation will be created from the KEY
class - class name, can be specified for complex values. If it is specified, instance of the class will be created and passed to the workflow instead of the hash table. Setters will be used to set the values, and the names of the method is generated from the key. If the key can not be used for this purpose, additional attribute ("setter") has to be specified
setter - used to specify setter method name in case it can not be generated from the key (for the complex objects which should be translated to CDRator objects automatically)
method - used to specify getter method name in case it can not be generated from the key (for the cases when in response CDRator objects should be translated to ComplexObjectDTO automatically)
list - attribute of the complex object, if = "true", complex object is translated to array list, valid both in request and response
Attributes:
...
Getting started
In order to get started with SOAP workflow framework you will have to include the Maven artifact in your pom.xml file as a runtime dependency.
<dependency> <groupId>com.cdrator.integration.soap</groupId> <artifactId>rator-soap-workflow</artifactId> <version>2.4</version> <scope>runtime</scope> </dependency>
If you are adding the SOAP workflow functionality to a existing customer project, then it is the best to implement this as a project module. E.g.: SIMYO/modules/workflowSoap/pom.xml. Note that usually the artifact dependency is specified in the parent pom.xml file with the version specified (e.g.: SIMYO/pom.xml):
<dependency> <groupId>com.cdrator.integration.soap</groupId> <artifactId>rator-soap-workflow</artifactId> <version>2.4</version> </dependency>
and in the module pom.xml file with the scope (e.g.: SIMYO/modules/workflowSoap/pom.xml):
<dependency> <groupId>com.cdrator.integration.soap</groupId> <artifactId>rator-soap-workflow</artifactId> <scope>runtime</scope> </dependency>
Also, don't forget to include the following dependency to build the deployable WEB application WAR file:
<dependency> <groupId>com.cdrator.integration.soap</groupId> <artifactId>rator-soap-workflow</artifactId> <classifier>webapp</classifier> <type>war</type> <scope>runtime</scope> </dependency>
In addition to that, configure the build process, Maven renamer and Maven WAR plugins. The example build section configuration might look like this:
<build> <finalName>simyo-workflow-soap</finalName> <plugins> <plugin> <groupId>com.cdrator.maven.plugins</groupId> <artifactId>rator-maven-renamer-plugin</artifactId> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <outputDirectory>${project.parent.build.directory}</outputDirectory> </configuration> </plugin> </plugins> </build>
Last thing to mention about this artifact is that starting from version 2.0 it uses JAX-WS for exposing endpoint and providing WSDL document.
if you are trying to create the separate project that uses SOAP workflow framework, then just include the dependencies in the main pom.xml file and configure the build section to create the correct WAR file.
In order to test if your set up is correct, build the project using Maven and try to deploy the built WAR file on Tomcat. If the deployment was successful, then go to the following address using your browser: http://<host>:<port>/your-application/InvokerService. You should see the minimal description of your endpoint. Note that this applies to the framework versions starting from 2.0 (JAX-WS based web services). If you want to get the WSDL document, then try to access the following URL: http://<host>:<port>/your-application/InvokerService?wsdl. You should be able to see the valid WSDL document. If the application was deployed without errors, but you are unable to access WSDL or endpoint description page, then please refer to log files, there might be some issues regarding parameter tree configuration.
Configuring parameters
Before starting to create the workflows and build your service layer.