NonStop SOAP 4.1 User's Manual

This section describes the following:
“Implementation of the pre_process() user-exit in NonStop SOAP 3” (page 63)
“Implementation of the post_process()user-exit in NonStop SOAP 3” (page 63)
“Migration of the pre_process() and post_process() user-exits in NonStop SOAP 4”
(page 64)
Implementation of the pre_process() user-exit in NonStop SOAP 3
In NonStop SOAP 3, the pre_process()user-exit logs the name of the service being invoked in
an audit file. The pre_process() user-exit is implemented in the <NonStop SOAP 3
Installation Directory>/samples/pathway/UserExits/SoapUEHandler_impl.cpp
file, using the SoapUEHandler_Generic::audit()method. The
SoapUEHandler_Generic::audit()function is called from the
SoapUEHandler_Generic::pre_process()method.
The following code sample shows the business logic implemented for the pre_process()
user-exit.
1 void
2 SoapUEHandler_Generic::audit() {
3 if (SoapUEHandler_Generic::auditFP == NULL) {
4 SoapUEHandler_Generic::auditFP = fopen("emp.audit", "a+");
5 if (SoapUEHandler_Generic::auditFP == NULL) {
6 gSoapError.log("Error while opening the audit file %ld\n", errno);
7 return;
8 }
9 gSoapError.log("Opened the audit file\n");
10 }
11 fprintf(SoapUEHandler_Generic::auditFP, "%s\n", serviceName);
12 fflush(SoapUEHandler_Generic::auditFP);
13 }
Checks for an existing file.Line 3
Opens a new file (with append permissions) using the fopen command, if the emp.audit file
does not exist.
Line 4
Error handling of File creation failure error.Line 5 8
Logs the serviceName in the emp.audit file.Line 11
Flush the file pointer to complete the write.Line 12
Implementation of the post_process()user-exit in NonStop SOAP 3
In NonStop SOAP 3, the post_process()user-exit adds the following XML processing instruction
to the response message for the empdb service:
<?xml-stylesheet type="text/xsl" href="empinfo.xsl" ?>
The post_process()user-exit is implemented in the <NonStop SOAP 3 Installation
Directory>/samples/pathway/UserExits/SoapUEHandler_impl.cpp file using the
stuffXSLT() method. The stuffXSLT()function is called from the
SoapUEHandler_Generic::post_process()method.
The following code sample shows the business logic implemented for the post_process()user-exit:
1 Static void stuffXSLT(OutputXML &outputXml, char *XSLTFileName)
2 {
3 if (!XSLTFileName || !XSLTFileName[0]) {
4 return;
5 }
Migrating NonStop SOAP 3 User-exits 63