NonStop SOAP 4.1 User's Manual
7 axiom_soap_envelope_t *soap_envelope = NULL;
8 axis2_svc_t* service_struct = NULL;
9 axis2_op_t* operation_struct = NULL;
10 const axis2_char_t* service_name = NULL;
11 const axis2_char_t* operation_name = NULL;
12 const axutil_qname_t* operation_qname = NULL;
13
14 int bytes_written = 0;
15 FILE* fp = NULL;
16
17 AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
18 AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
19 AXIS2_LOG_DEBUG(env->log,AXIS2_LOG_SI, "Starting empdb pre_process handler .........");
20
21 service_struct= axis2_msg_ctx_get_svc (msg_ctx,env);
22 service_name = axis2_svc_get_name(service_struct, env);
23
24 fp = fopen("../modules/mod_empdb/emp.audit", "a+");
25 if(!fp){
26 AXIS2_LOG_DEBUG(env->log,AXIS2_LOG_SI,"Error in opening theemp.audit file");
27 fclose(fp);
28 return AXIS2_FAILURE;
29 }
30 bytes_written = fwrite(axutil_strcat(env,service_name,"\n",NULL),
31 sizeof(axis2_char_t), axutil_strlen(service_name), fp);
32 fclose(fp);
33
34 /* The following section should be used when one needs to implement
35 the business logic at the operation level*/
36 /*operation_struct = axis2_msg_ctx_get_op(msg_ctx,env);*/
37 /*operation_qname = axis2_op_get_qname(operation_struct, env);*/
38 /*operation_name = axutil_qname_get_localpart(operation_qname, env);*/
39 /*if(!axutil_strcmp(operation_name,"EmpInfo")){*/
40 /* TODO :: Insert your business logic here */
41 /*}*/
42 /*if(!axutil_strcmp(operation_name,"EmpDel")){*/
43 /* TODO :: Insert your business logic here */
44 /*}*/
45 /*if(!axutil_strcmp(operation_name,"EmpAdd")){*/
46 /* TODO :: Insert your business logic here */
47 /*}*/
48 return AXIS2_SUCCESS;
49 }
The SoapAdminCL tool generates the code that lists the function and variable declaration.Line 1 - 13
Initializes a file pointer variable.Line 15
Checks for errors.Line 17 - 19
Fetches the service structure that includes details about the invoked service.Line 21
Retrieves the service structure name fetched in step 21.Line 22
Opens the emp.audit file and writes the service name in it.Line 24 - 32
This code is useful when you have a business logic that needs to be implemented at the
operation level.
Line 36 - 47
NOTE: The NonStop SOAP distribution includes the complete implementation of the
pre_process() handler. You can either write your own business logic or copy the source code
of the pre_process() handler from the NonStop SOAP installation directory using the following
command:
OSS>cp <NonStop SOAP 4 Installation Directory>/sample_services/modules
/mod_empdb/src/empdb_pre_process_handler.c
<NonStop SOAP 4 Deployment Directory>/modules
/mod_empdb/src/empdb_pre_process_handler.c
Migrating the post_process() user-exit business logic
To migrate the business logic for the post_process() user-exit to the post_process handler,
complete the following steps:
1. Open the empdb_post_process_handler.c stub file generated in the <NonStop SOAP
Deployment Directory>/modules/mod_empdb/src directory.
Migrating NonStop SOAP 3 User-exits 67










