NonStop SOAP User's Manual
NonStop SOAP User-Exits
NonStop SOAP User’s Manual—520501-012
C-26
SOA Enable a Nonstop Server Application With
User-Exits
Pre_Service()
long SoapUEHandler_TOUPPER::pre_service(ServiceReqResponse
*req,
SoapFault *sf)
// Set the NSTuxedo environment variables
// Validate the buffers.
// Call the TOUPPER service to change the case of the
characters.
// Return the buffer.
{
sendlen=req->getDDLBufferLen();
tuxputenv(“TUXCONFIG=/usr/mytux/tuxconfig”)
tuxputenv=(“TUXDIR=/tuxedo8.0”)
char *sendbuftmp = req->getDDLBuffer();
(void) strcpy(sendbuf, sendbuftmp);
ret = tpcall ("TOUPPER", (char *)sendbuf, 0, (char
**)&rcvbuf, &rcvlen, (long)0);
}
This function replaces the normal NonStop SOAP Service() processing. It creates
the NonStop Tuxedo Service Request buffer and invokes the TOUPPER service via a
tpcall(). The TOUPPER service changes the case of the characters in the request
buffer and returns the buffer as the response.
tpcall() is a synchronous function. To use this for our example, we have defined
two buffers: the send buffer (sendbuf) and the receive buffer (rcvbuf). These are
defined as local variables that hold the Service Request and Service Response
buffers, respectively. To pass the Service Response buffer out of the Pre_Service()
user-exit, we have declared respBuf as a public member of the
SoapUEHandler_TOUPPER class.
Note that the NonStop Tuxedo TOUPPER service is very simple—there is only a single
field defined in the Service Request and Response buffers, so the buffer manipulation
code in this example is trivial. In real life, this code will probably be more complex in
order to properly transform the Service Request and Response buffers from and to the
SOAP Request and Response structures expected by the NonStop SOAP server.
The TUXCONFIG and TUXDIR environment variables should be specified
appropriately for your configuration. When executing the NonStop SOAP server from a
command prompt, the TUXCONFIG and TUXDIR environment variables can be set
using the OSS EXPORT command (via shell scripts or setup files). Otherwise, they
should be set programmatically by the user-exit using the tuxputenv() function as
shown in this example.