In this process we have 2 services, FSA and XML Validation.
We will show 3 different cases, one when FSA throws the error 'No files to collect', another error thrown by the XMLValidation Service 'schema:validationerr' and finally generic error that is forced by BP Exception Service.
For handling specific errors, Error Value in Property Editor of OnFault group must be exactly Advanced Status returned by a service error.
In our cases we will handle 3 advanced statuses, as mentioned above. For BP Exception Service, Error Value is what has been defined in exceptionCode of BP Exception service. Errors/Exceptions that are handled in this BPs are:
- No file to collect
- schema:validationerr
- 32
The last error 32 is not handled as a specific error, but through a generic part. Generic or any kind of error will be handled through Default OnFault part, that does not have any Error Value defined. Default error, without specific error value, always must be listed as the last one, because first specific errors will be handled and if any specific has been found in the list, then the error will be processed by process defined in a Default part.
If the Default part is placed in the first position, and specific errors after that, then any error will be processed by Default handling, and never go further to check if the specific error exists in the list.
Here is the example of the process:
Bpml code:
<process name="default">
<sequence name="mainSequence">
<operation name="File System Adapter">
<participant name="FS_InstallValidation"/>
<output message="FileSystemInputMessage">
<assign to="." from="*"></assign>
<assign to="filter">*.txt</assign>
<assign to="deleteAfterCollect">false</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="XML Validation Service">
<participant name="XMLValidator_WellFormed"/>
<output message="XMLValidatorInputMessage">
<assign to="." from="*"></assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="Business Process Exception">
<participant name="BPExceptionService"/>
<output message="BPExceptionServiceTypeInputMessage">
<assign to="." from="*"></assign>
<assign to="exceptionCode">32</assign>
<assign to="statusReport">my own error ...</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<onFault code="No files to collect">
<sequence name="Sequence Start">
<assign name="Assign" to="ERROR">There is no files to collect from collection Folder!</assign>
</sequence>
</onFault>
<onFault code="schema:validationerr">
<sequence name="Sequence Start">
<assign name="Assign" to="ERROR">XML validation error, Primary Document is not well-formed XML</assign>
</sequence>
</onFault>
<onFault>
<sequence name="Sequence Start">
<operation name="Business Process Metadata">
<participant name="BPMetaDataInfoService"/>
<output message="BPMetaDataServiceTypeInputMessage">
<assign to="." from="*"></assign>
<assign to="TRACE">TRUE</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="XSLT Service">
<participant name="XSLTService"/>
<output message="XSLTServiceTypeInputMessage">
<assign to="." from="*"></assign>
<assign to="xslt_name">TEST_error</assign>
<assign to="xml_input_from">ProcData</assign>
<assign to="input_pd_xpath">/</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="Mail Mime Service">
<participant name="MailMimeService"/>
<output message="MailMimeServiceInputMessage">
<assign to="." from="*"></assign>
<assign to="mail-mime-subject">GIS error</assign>
<assign to="mail-mime-sender">GIS_admin</assign>
<assign to="mail-mime-operation">build</assign>
<assign to="mail-mime-recipient">mirjana.vojvodic@tis.hr</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="SMTP Send Adapter">
<participant name="SMTP_SEND_ADAPTER"/>
<output message="SMTP_SEND_ADAPTERInputMessage">
<assign to="." from="*"></assign>
<assign to="xport-smtp-mailto">mirjana.vojvodic@tis.hr</assign>
<assign to="xport-smtp-mailhost">192.168.100.128</assign>
<assign to="b2b-raw-message">true</assign>
<assign to="xport-smtp-mailport">25</assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
</sequence>
</onFault>
</sequence>
</process>
To get the first error processed, No files to collect, you can set the filter in FSA to *.txt, as any txt file will not be found there
<assign to="filter">*.txt</assign>
Process monitor, process flow:
Process Data:
We can find the ERROR element in the Process Data that was created by Assign from OnFault.
<?xml version="1.0" encoding="UTF-8"?>
<ProcessData>
<Prev_NotSuccess_Adv_Status>No files to collect</Prev_NotSuccess_Adv_Status>
<ERROR_SERVICE>
<WFD_NAME>TEST_onFault_oneSequence</WFD_NAME>
<SERVICE_NAME>FS_InstallValidation</SERVICE_NAME>
<STEP_ID>1</STEP_ID>
<ADV_STATUS>No files to collect</ADV_STATUS>
<BASIC_STATUS>1</BASIC_STATUS>
<WFC_ID>lin2:node1:12728cff242:5359512</WFC_ID>
</ERROR_SERVICE>
<ERROR>There is no files to collect from collection Folder!</ERROR>
</ProcessData>
State of the BP:
You can see that either BP has an error, it is in the Completed state, because Assign from OnFault finished successfully (3rd step in above picture):
To get the second error processed, schema:validationerr, you can set the filter in FSA to *.vld, file will be found there, but not validated by XML Validation service
<assign to="filter">*.vld</assign>
Process Monitor, process flow:
Process Data:
We can find the ERROR element in the Process Data that was created by Assign from OnFault:
<?xml version="1.0" encoding="UTF-8"?>
<ProcessData>
<FileName>testdata.vld</FileName>
<XMLValidationError>
<errorDetail>Content is not allowed in prolog.</errorDetail>
</XMLValidationError>
<Prev_NotSuccess_Adv_Status>schema:validationerr</Prev_NotSuccess_Adv_Status>
<ERROR_SERVICE>
<WFD_NAME>TEST_onFault_oneSequence</WFD_NAME>
<SERVICE_NAME>XMLValidator_WellFormed</SERVICE_NAME>
<STEP_ID>2</STEP_ID>
<ADV_STATUS>schema:validationerr</ADV_STATUS>
<BASIC_STATUS>1</BASIC_STATUS>
<WFC_ID>lin2:node1:12728cff242:5392534</WFC_ID>
</ERROR_SERVICE>
<ERROR>XML validation error, Primary Document is not well-formed XML</ERROR>
</ProcessData>
State of the BP:
This process is again in the Completed State as a previous one, because of proper OnFault handling:
Handling a default error, that is like 'any error', we can force the process to pass both steps correctly (FSA and XML Validation) and force an error by BP Exception service
- Create the file test.xml in /SI_install_dir/install/data/validation/collect.
- Content of that file can the simpliest well-formed XML format as follows:
<root></root>
- Change the filter in FSA into *.xml:
<assign to="filter">*.txt</assign>
Process Monitor, Process flow:
Advanced status returned by BP Exception Service, that is 32, has not been processed as a specific error, because it was not listed in OnFault error values, but it is then processed as a generic/default error. In Default error, we send a mail, that can be seen above.
XSLT used for that process is TEST_error.xslt:
<?xmlversion="1.0" encoding="iso-8859-2"?>
<xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output encoding="iso-8859-2" method="html"></xsl:output>
<xsl:template match="/">
Error appeared in a process!
<br></br>
<br></br>
Details about error:
<br></br>
<br></br>
<table border="1">
<tr>
<th align="left">BP name</th>
<td><xsl:value-of select="//ERROR_SERVICE/WFD_NAME/text()"></xsl:value-of></td>
</tr>
<tr>
<th align="left">BP ID</th>
<td><xsl:value-of select="//WORKFLOW_ID/text()"></xsl:value-of></td>
</tr>
<tr>
<th align="left">Service Name (error)</th>
<td><xsl:value-of select="//ERROR_SERVICE/SERVICE_NAME/text()"></xsl:value-of></td>
</tr>
<tr>
<th align="left">Step Id</th>
<td><xsl:value-of select="//ERROR_SERVICE/STEP_ID/text()"></xsl:value-of></td>
</tr>
<tr>
<th align="left">Advanced Status</th>
<td><xsl:value-of select="//ERROR_SERVICE/ADV_STATUS/text()"></xsl:value-of></td>
</tr>
</table>
<br></br>
<br></br>
To see more details about BP, go to SI administration:
<br></br>
<a><xsl:attribute name="href">http://192.168.101.144:16000/dashboard</xsl:attribute>http://192.168.101.144:16000/dashboard</a>
<br></br>
<br></br>
GIS admin
</xsl:template>
</xsl:stylesheet>
The mail is:
Process state:
Again, we can see that process 130670 finished with Completed state: