NonStop SOAP 4.1 User's Manual

Migrating the pre_service() and pre_marshal() user-exits in NonStop SOAP 3 to Message
Receiver User Functions in NonStop SOAP 4.1
The empdb_MRUF sample shows the migration of the pre_service() and pre_marshal()
user-exits in NonStop SOAP 3 to the corresponding Message Receiver User Functions attached to
the empdb sample service deployed in NonStop SOAP 4.1. For more information about deploying
the empdb service, see Chapter 2: “Installing NonStop SOAP” (page 36).
The following sections describe:
“Implementation of the pre_service() and pre_marshal() user-exit in NonStop SOAP
3” (page 71)
“Migration of pre_service() and pre_marshal() user-exits in NonStop SOAP 4.1”
(page 72)
Implementation of the pre_service() and pre_marshal() user-exit in NonStop SOAP 3
The pre_service()user-exit in NonStop SOAP 3 sets the least significant digit of the branchnum
parameter to 0 if it is set to 9 and the operation being invoked is EmpAdd. The
pre_service()user-exit is implemented in the SoapUEHandler_impl.cpp file located in the
<NonStop SOAP 3 Installation Directory>/samples/pathway/UserExits directory
using the SoapUEHandler_Generic::pre_service() method.
The following code implements the business logic for the pre_service() user-exit in NonStop
SOAP 3:
1 long
2 SoapUEHandler_Generic::pre_service(ServiceReqResponse *req,
SoapFault *sf)
3 {
4 gSoapTrace.log("Entered SoapUEHandler_Generic::pre_service\n");
5 gSoapTrace.log("DDL Buf Len: %ld\n", req->getDDLBufferLen());
6 if (!strcmp(serviceName, "EmpAdd")) {
7 employee_add_def *eadd_req;
8 eadd_req = (employee_add_def *) req->getDDLBuffer();
9 // If the branch number is not set.. set it to '9'
10 if (eadd_req->employee_info.branchnum[0] == 9) {
11 eadd_req->employee_info.branchnum[0] = '0';
12 }
13 }
14 gSoapTrace.log("Leaving SoapUEHandler_Generic::pre_service\n");
15 return 0;
}
Checks if the service name is EmpAdd.Line 6
Extracts the request structure.Line 8
Sets branchnum to 0 if it is 9.Line 10-11
The pre_marshal() user-exit in NonStop SOAP 3 sets the skipMarshal flag, which skips the
marshalling routine of NonStop SOAP 3 if the service name is EmpAdd.
This functionality is implemented in the SoapUEHandler_impl_2.cpp file located in the
<NonStop SOAP 3 Installation Directory>/samples/pathway/UserExits directory
using the SoapUEHandler_Generic::pre_marshal() method, which implements the business
logic for the pre_marshal() user-exits.
Migrating NonStop SOAP 3 User-exits 71