Hi  Dinesh,

     Thank you very much for your reply. I am attaching my source codes to you. 
There are 4 files,

     1) axis2.h and axis2.c define the necessary functions to create AXIS2C 
environment, build  and desserialize SOAP message
     2) client.c is the client program
     3) test.c is the server program
    
    many thanks again for your help.

best regards
yong 


>>  Hi Yong,
 >>  Please see my comments inline.
 >>  Yong Yang <[EMAIL PROTECTED]> writes:

 >>  > 1)connection time out
 >>  > If the service is terminated and hence cause the web server
 >>  > terminated after receives a request from the client, the client will
 >>  > be waiting for a reply indefinitely in case of SEND-AND-RECEIVE
 >>  > pattern. How can I configure my client program so that the client
 >>  > will be time out?
 >>  I think this happens because of we didn't handle the occasion that
 >>  socket read sends 0. Therefore it hangs. Modified the code to give an
 >>  error when it receives 0. Please get a checkout from svn head and tryout.

 >>  > 2)send attachment
 >>  > for example, the client will attach three files to the web service. 
 >>  > a) The first file exists and is not empty
 >>  > b) The second file doesn't exist or it is empty.
 >>  > c) The third file exists and is not empty
 >>  >
 >>  > when the server receives the SOAP message, it will try to detach
 >>  > these files. But the server only can detach the first file and can
 >>  > not detach the third file. When I used the TCP MONITOR to trace the
 >>  > SOAP message, the first MIME contains the content of the first file;
 >>  > the second MIME is empty; the third MIME contains the content of the
 >>  > third file. I also check what is the content in corresponding binary
 >>  > node, I found the binary node in both second and third attachment
 >>  > node are NULL.

 >>  please raise a jira for this issue. We will be able to help you. If
 >>  possible please attach your code there also. Need to understand
 >>  whether there is a bug actually.
 >>  >
 >>  > How can the server ignore the empty attachment and detach the following
 >>  attachment?
 >>  >
 >>  > 3)send back attachment
 >>  > If the server would like to send back the attachment to the client in
 >>  case of SEND-AND-RECEIVE message pattern, it seems that the server can
 >>  not attach these files. When I used the TCP monitor to trace the SOAP
 >>  message, no any MIME in the SOAP reply even if I enable the MTOM options
 >>  in the server program. When I read some doucments, it seems tha tthe
 >>  OPTIONS only can associate with CLIENT. How can I associate the OPTIONS
 >>  with the server as well?
 >>  >
 >>  If possible please attach source for this scenario also.

 >>  thanks,
 >>  Dinesh

 >>  -- 
 >>  Dinesh Premalal
 >>  [EMAIL PROTECTED]
 >>  WSO2, Inc.; http://www.wso2.com/
 >>  GPG Key ID : A255955C
 >>  GPG Key Finger Print : C481 E5D4 C27E DC34 9257  0229 4F44 266E A255 955C

 >>  ---------------------------------------------------------------------
 >>  To unsubscribe, e-mail: [EMAIL PROTECTED]
 >>  For additional commands, e-mail: [EMAIL PROTECTED]
/*
 * This is a web service call test
 */
        #include <axis2_svc_skeleton.h>
        #include <axis2_log_default.h>
        #include <axis2_error_default.h>
        #include <axiom_text.h>
        #include <axiom_node.h>
        #include <axiom_element.h>
        #include <axis2_array_list.h>
        #include <stdio.h>

        #include <axiom_soap.h>
        #include <axis2_client.h>

        //this includes nessary functions to build SOAP and deserialize SOAP
        #include "axis2.h"





/*
 * 2 declare the function prototypes of server skeleton
 */

        //four function prototypes declared in "axis2_svc_skeleton.h"
        // the serviceName is the name of service in the service deploy file, 
service.xml
        //so you should replace the serviceName with actual service name

        axiom_node_t* AXIS2_CALL
        test_invoke(axis2_svc_skeleton_t *svc_skeleton,
                const axis2_env_t *env,
                axiom_node_t *node,
                axis2_msg_ctx_t *msg_ctx);


        int AXIS2_CALL
        test_init(axis2_svc_skeleton_t *svc_skeleton,
                const axis2_env_t *env);

        int AXIS2_CALL
        test_free(axis2_svc_skeleton_t *svc_skeleton,
            const axis2_env_t *env);

        axiom_node_t* AXIS2_CALL
        test_on_fault(axis2_svc_skeleton_t *svc_skeli,
                const axis2_env_t *env, axiom_node_t *node);

        
        
        // here we will declare a wrapper function for operation1

        axiom_node_t *axis2_test_operation1(const axis2_env_t *env,
                axiom_node_t *node);



        /* Initialize the service */
        int AXIS2_CALL
        test_init(axis2_svc_skeleton_t *svc_skeleton,
                const axis2_env_t *env)
        {
            svc_skeleton->func_array = axis2_array_list_create(env, 0);

            AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array, env, "func1");

            return AXIS2_SUCCESS;
        }

        axiom_node_t* AXIS2_CALL
        test_invoke(axis2_svc_skeleton_t *svc_skeleton,
                const axis2_env_t *env,
                axiom_node_t *node,
                axis2_msg_ctx_t *msg_ctx)
        {
             /* invoke ritht operation wraper according to the operation name.
              */
             if (node)
             {
                if (AXIOM_NODE_GET_NODE_TYPE(node, env) == AXIOM_ELEMENT)
                {
                   axiom_element_t *element = NULL;
                   element = (axiom_element_t 
*)AXIOM_NODE_GET_DATA_ELEMENT(node, env);
                   if (element)
                   {
                     axis2_char_t *op_name = 
AXIOM_ELEMENT_GET_LOCALNAME(element, env);
                     if (op_name)
                     {


                        /* here the func1 is the name of one operation in the 
service
                         * if you have more operations, just repeat the 
following one
                         */
                        if (AXIS2_STRCMP(op_name, "func1") == 0)
                        {

                            return axis2_test_operation1(env, node);

                        }
                     }
                   }
                }
             }
             //the root node of SOAP request is null, or there is no such 
operation
             //return NULL
             return NULL;
        }


        /*
         * when there is a fault, the fault handler will deal with
         * here is one simple code to deal with fault
         */
        axiom_node_t* AXIS2_CALL
        test_on_fault(axis2_svc_skeleton_t *svc_skeli,
                const axis2_env_t *env, axiom_node_t *node)
        {
            axiom_node_t *error_node = NULL;
            axiom_node_t* text_node = NULL;
            axiom_element_t *error_ele = NULL;
            error_ele = axiom_element_create(env, node, "Service Error", NULL,
                    &error_node);
            AXIOM_ELEMENT_SET_TEXT(error_ele, env, "service service failed ",
                    text_node);
            return error_node;
        }

        /*
         * free the resources used by the skeleton
         */
        int AXIS2_CALL
        test_free(axis2_svc_skeleton_t *svc_skeleton,
                const axis2_env_t *env)
        {
            /* Free the function array */
            if (svc_skeleton->func_array)
            {
                AXIS2_ARRAY_LIST_FREE(svc_skeleton->func_array, env);
                svc_skeleton->func_array = NULL;
            }
            /* Free the function pointer */
            if (svc_skeleton->ops)
            {
                AXIS2_FREE(env->allocator, svc_skeleton->ops);
                svc_skeleton->ops = NULL;
            }
            /* Free the service skeleton */
            if (svc_skeleton)
            {
                AXIS2_FREE(env->allocator, svc_skeleton);
                svc_skeleton = NULL;
            }

            return AXIS2_SUCCESS;
        }

        /*
         * create function of the service skeleton
         */
        axis2_svc_skeleton_t *
        axis2_test_create(const axis2_env_t *env)
        {
            axis2_svc_skeleton_t *svc_skeleton = NULL;
            svc_skeleton = AXIS2_MALLOC(env->allocator,
                    sizeof(axis2_svc_skeleton_t));

            svc_skeleton->ops = AXIS2_MALLOC(
                        env->allocator, sizeof(axis2_svc_skeleton_ops_t));


            svc_skeleton->func_array = NULL;
            svc_skeleton->ops->free = test_free;
            svc_skeleton->ops->init = test_init;
            svc_skeleton->ops->invoke = test_invoke;
            svc_skeleton->ops->on_fault = test_on_fault;

            return svc_skeleton;
        }

        /*
         * two extra functions, get instance and remove instance,
         * that the service skeleton must implemented
         */
        AXIS2_EXPORT int
        axis2_get_instance(axis2_svc_skeleton_t **inst,
                const axis2_env_t *env)
        {
            *inst = axis2_test_create(env);
            if (!(*inst))
            {
                return AXIS2_FAILURE;
            }

            return AXIS2_SUCCESS;
        }

        AXIS2_EXPORT int
        axis2_remove_instance(axis2_svc_skeleton_t *inst,
                const axis2_env_t *env)
        {
            axis2_status_t status = AXIS2_FAILURE;
            if (inst)
            {
                status = AXIS2_SVC_SKELETON_FREE(inst, env);
            }
            return status;
        }


/*
 * Implement the operation wrapper for operation1
 * here is just one example how to implement the wrapper
 */

        axiom_node_t *
        axis2_test_operation1(const axis2_env_t *env, axiom_node_t *node)
        {

             //the number of parameter you expect to receive
              const int expected_number_of_parameter = 2;

              //an array to store parameter value
              axis2_char_t *parameter_value[expected_number_of_parameter];

              //an array to store attachment file name and path name
              axis2_char_t *receive_attachment_name[MAX_ATTACHMENT];

              receive_attachment_name[0] = "temp1";
              receive_attachment_name[1] = "temp2";
              receive_attachment_name[2] = "temp3";
              receive_attachment_name[3] = "temp4";
              receive_attachment_name[4] = "temp5";

              //the variable will be used to store the actual number of 
attachments
              int receive_attachment_number = 0;


axis2_char_t* buffer = NULL;
if(node)
{

buffer = AXIOM_NODE_TO_STRING(node, env);
printf("received node is : %s\n", buffer);
}
              //deserialize the SOAP message and return the node of last 
parameter
              axiom_node_t *last_parameter_node = deserialize_SOAP(env, node,
                           parameter_value, expected_number_of_parameter);

              if(!last_parameter_node)
              {
                  //the number of parameter from client is not same as the 
number
                  // the user expected, return NULL to tell client there is 
something wrong
                  return NULL;
              }
              else  //check whehter there is any attachment
              {
                  receive_attachment_number = deserialize_attachment(env,
                                          last_parameter_node, 
receive_attachment_name);
              }


//exit(0);

int i;
for(i = 0; i < expected_number_of_parameter;i++)
   printf("parameter value is : %s\n", parameter_value[i]);
printf("the number of attachment is : %d\n", receive_attachment_number);


              //ignore to invoke the real opration1 and just return a set of 
values and attachments
              //..........


                //build SOAP body

                const int result_node_number = 3;

                //an array to store each node name of result
                axis2_char_t *result_node[result_node_number];

                //an array to store each result values
                axis2_char_t *result_value[result_node_number - 1];

                //an array to store the namespace for each node
                axiom_namespace_t *name_space[result_node_number];

                //initialize the these array
                result_node[0] = "result";
                result_node[1] ="r1";
                result_node[2]="r2";


                result_value[0]="90";
                result_value[1]="10";


                //you can indicate the name space for node explicitly
                //or the node is without namespace, just assign "NULL"
                name_space[0] = axiom_namespace_create(env,
                              "http://www.querix.com/test";,
                              "ts1");
                name_space[1]=NULL;
                name_space[2]=NULL;
//If you would like to attach some files, you can use the following
//statements to enable MIMIE option
axis2_options_t *options = NULL;

options = axis2_options_create(env);
AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, AXIOM_SOAP11);
AXIS2_OPTIONS_SET_ENABLE_MTOM(options, env, AXIS2_TRUE);


                //call the build_SOAP_body function to build SOAP body of result
                axiom_node_t* returnNode = build_SOAP_body(env, result_node,
                         result_value, result_node_number, name_space);

                //check whether the building is successful
                if(!returnNode)
                {
                   printf("failed to build to SOAP body\n");
                   return NULL;
                }


                //the acutal number of attachment files
                int attachment_number = 2;
                //an array to store the file name and path name of each 
attachment
                //MAX_ATTACHMENT is defined in "querix.h"
                axis2_char_t *attachment_file_name[MAX_ATTACHMENT];
                //an array to store the content type of each attachment
                //e.g., "text/plain", "text/html"
                axis2_char_t *content_type[MAX_ATTACHMENT];

                //initilize the these array

                attachment_file_name[0]="1.txt";
                attachment_file_name[1]="2.txt";
/*
FILE *fp;
fp=fopen(attachment_file_name[0], "r");
int c;
while ((c = fgetc(fp)) != EOF)
{
    printf("%c",c);
}
printf("\n");
*/


                content_type[0]="text/plain";
                content_type[1]="text/plain";


                //Attach these file into SOAP
                build_SOAP_attachment(env, returnNode, attachment_file_name, 
content_type, attachment_number);

                return returnNode;
            }


/*
 *
 */
#include "axis2.h"
#include <stdio.h>

axis2_env_t *
createEnvironment(axis2_char_t* log_file)
{
        axis2_env_t *env = NULL;
        axis2_error_t *error = NULL;
        axis2_log_t *log = NULL;
        axis2_allocator_t *allocator = NULL;

        // set up the envioronment with allocator and log
        allocator = axis2_allocator_init(NULL);
        error = (axis2_error_t *) axis2_error_create(allocator);
        log = (axis2_log_t *) axis2_log_create(allocator, NULL, log_file);
        env = axis2_env_create_with_error_log(allocator, error, log);
        env->log->level = AXIS2_LOG_LEVEL_TRACE;
        axis2_error_init();
        return env;
}




axiom_node_t *
build_SOAP_body(const axis2_env_t *env,
        axis2_char_t *node_name[],
        axis2_char_t *element_text[],
        int number_node,
        axiom_namespace_t *name_space[])
{
          //root node of SOAP message
          axiom_node_t *payload = NULL;

          axiom_node_t *child_node = NULL;
          axiom_element_t *element = NULL;

          int index = 0;

          
          //number_node is at least larger than 1 and first node is not null
          //otherwise there is an error

          if(number_node > 0 && node_name[index])
          {
               //create the root node(payload) with the namespace, 
name_space[index]
               axiom_element_create(env, NULL, node_name[index], 
name_space[index], &payload);

               index++;

               /*if there is second, third,..., node, add them into payload */
               while(index < number_node && node_name[index])
               {

                 element = axiom_element_create(env, payload,
                         node_name[index], name_space[index], &child_node);

                 AXIOM_ELEMENT_SET_TEXT(element, env,
                         element_text[index - 1], child_node);

                 index ++;
               }
          }

          //When there is error, return NULL pointer
          if(index == number_node)
                return payload;
          else
                return NULL;
}

void build_SOAP_attachment(const axis2_env_t *env,
        axiom_node_t *root_node,
        axis2_char_t *attachment_file_name[],
        axis2_char_t *content_type[],
        int attachment_number)
{
        axiom_node_t* attachment_node = NULL;
        axiom_node_t* attachment_data_node = NULL;
        axiom_element_t* attachment_element = NULL;
        axiom_text_t* attachment_data_text = NULL;
        axiom_data_handler_t *data_handler = NULL;

        int index;
        for(index = 0; index < attachment_number; index++)
        {
               if(attachment_file_name[index]&& content_type[index])
               {
                     attachment_element = axiom_element_create(env, root_node,
                                         "attachment", NULL, &attachment_node);

                      data_handler = axiom_data_handler_create(env, 
attachment_file_name[index],
                                content_type[index]);

                      attachment_data_text = 
axiom_text_create_with_data_handler(env, attachment_node,
                                data_handler, &attachment_data_node);
//printf("here attach file : %s\n", attachment_file_name[index]);
//FILE *fp;
//fp=fopen(attachment_file_name[index], "r");
//int c;
//while ((c = fgetc(fp)) != EOF)
//{
//    printf("%c",c);           /* O/P the character to the screen      */
//}
//printf("\n");

               }
          }
}


axiom_node_t* deserialize_SOAP(const axis2_env_t *env,
        axiom_node_t *node,
        axis2_char_t *element_value[],
        int expect_element_number)

{
        int index = 0;
        axiom_node_t *current_node = NULL;
        axiom_node_t *next_node = NULL;
        axiom_node_t *element_node = NULL;
        axiom_text_t *element_text = NULL;

        if(node)
        {
            //get first node and deserialize its element

           current_node = AXIOM_NODE_GET_FIRST_CHILD(node, env);

           if(current_node)
           {
               element_node = AXIOM_NODE_GET_FIRST_CHILD(current_node, env);
               if (element_node &&
                     AXIOM_NODE_GET_NODE_TYPE(element_node, env) == AXIOM_TEXT)
               {
                    element_text = (axiom_text_t 
*)AXIOM_NODE_GET_DATA_ELEMENT(element_node, env);

                    if (element_text && AXIOM_TEXT_GET_VALUE(element_text , 
env))
                    {
                       element_value[index] = 
AXIOM_TEXT_GET_VALUE(element_text, env);

                       index++;
                    }
               }
            }
            // As SOAP message can contain a set of elements, we will check 
whether
            // there is any other elements.if so, deserialize them

            next_node = AXIOM_NODE_GET_NEXT_SIBLING(current_node, env);

            //make sure only deserialize body element, not attachment
            if((next_node !=NULL) &&(index < expect_element_number))
            {
                 element_node = AXIOM_NODE_GET_FIRST_CHILD(next_node, env);

                 if (element_node &&
                     AXIOM_NODE_GET_NODE_TYPE(element_node, env) == AXIOM_TEXT)
                 {
                     element_text = (axiom_text_t 
*)AXIOM_NODE_GET_DATA_ELEMENT(element_node, env);

                     if (element_text
                        && AXIOM_TEXT_GET_VALUE(element_text , env))
                     {
                         element_value[index] = 
AXIOM_TEXT_GET_VALUE(element_text, env);
                         index++;
                     }
                 }
                 current_node = next_node;

            }
        }
        if((index) == (expect_element_number))
        {
            return current_node;
        }
        else //there is error in the SOAP message body
        {
            return NULL;
        }
 }


 int deserialize_attachment(const axis2_env_t *env,
        axiom_node_t *node,
        axis2_char_t *attachment_file_name[])
 {
        axiom_node_t* current_attachment = NULL;
        axiom_node_t* previous_attachment = NULL;

        int actual_attachment_number = 0;

        int i;

        // get the first attachment node

        current_attachment = AXIOM_NODE_GET_NEXT_SIBLING(node, env);


axis2_char_t* buffer = NULL;
if(current_attachment)
{
buffer = AXIOM_NODE_TO_STRING(current_attachment, env);
printf("current attachment node is : %s\n", buffer);
}       
        while((current_attachment) &&(actual_attachment_number < 
MAX_ATTACHMENT))
        {


                //if the attachment node has no any data, just igore it and 
look at next one
                axiom_node_t *include_node = NULL;
                include_node = AXIOM_NODE_GET_FIRST_CHILD(current_attachment, 
env);


                if (include_node)
                {

buffer = AXIOM_NODE_TO_STRING(include_node, env);
printf("include node is : %s\n", buffer);

                    axiom_node_t *binary_node = NULL;
                    binary_node = AXIOM_NODE_GET_FIRST_CHILD(include_node, env);

                    if (binary_node)
                    {
buffer = AXIOM_NODE_TO_STRING(binary_node, env);
printf("binary node is : %s\n", buffer);
                        axiom_data_handler_t *data_handler = NULL;
                        axiom_text_t *bin_text = (axiom_text_t *)
                                AXIOM_NODE_GET_DATA_ELEMENT(binary_node, env);
                        data_handler = AXIOM_TEXT_GET_DATA_HANDLER(bin_text, 
env);
                        if (data_handler)
                        {

                            AXIOM_DATA_HANDLER_SET_FILE_NAME(data_handler,
                                 env, 
attachment_file_name[actual_attachment_number]);

                            AXIOM_DATA_HANDLER_WRITE_TO(data_handler, env);

                            actual_attachment_number++;
                        }
                    }
                }

                //move to next attachment node even if the current attachment 
node is empty
                previous_attachment = current_attachment;

                current_attachment = 
AXIOM_NODE_GET_NEXT_SIBLING(previous_attachment, env);


        }
        return actual_attachment_number;
}


/*
 * This is a client to call the service, test
 */


          #include <axiom.h>
          #include <axis2_util.h>
          #include <axiom_soap.h>
          #include <axis2_client.h>
          #include <stdio.h>
          //this includes the necessary functons to build soap and deserialize 
SOAP
          #include "axis2.h"


int main(int argc, char** argv)
{
   axis2_env_t* env = createEnvironment("MyTest.log");

          /*
           * create an options instance and set options
           */

          axis2_char_t *address = NULL;
          axis2_endpoint_ref_t* endpoint_ref = NULL;
          axis2_options_t *options = NULL;

          options = axis2_options_create(env);

          //If you would like to attach some files, you can use the following
          //statements to enable MIMIE option
          AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, AXIOM_SOAP11);
          AXIS2_OPTIONS_SET_ENABLE_MTOM(options, env, AXIS2_TRUE);

          //AXIS2_OPTIONS_SET_TIMEOUT_IN_MILLI_SECONDS( options, env, 10 );

          //set the web service address.

          address = "http://localhost:9090/axis2/services/test";;
          endpoint_ref = axis2_endpoint_ref_create(env, address);
          AXIS2_OPTIONS_SET_TO(options, env, endpoint_ref);


          /*
           *  Create a service client instance
           */

         axis2_char_t *client_home = NULL;
         axis2_svc_client_t* svc_client = NULL;
         axiom_node_t *payload = NULL;

         //client_home points to the Axis2/C default deploy folder
         //in which the configuration file, axis2.xml, will piecked up
         //you should set the environement, AXIS2C_HOME, to the AXIS2C
         // default deploy folder

         client_home = AXIS2_GETENV("AXIS2C_HOME");

         // validate client_home
         if (!client_home || !strcmp (client_home, ""))
             client_home = "../..";

         svc_client = axis2_svc_client_create(env, client_home);

         //validate svc_client
         if (!svc_client)
         {
              //here the error handler for failare to create svc_client
              AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Service client is NULL");

         }
         AXIS2_SVC_CLIENT_SET_OPTIONS(svc_client, env, options);


/*
 *  build the payload of SOAP message
 */


          /* build SOAP body*/
          const int body_node_number = 3;
          //an array to store each node name
          axis2_char_t *body_node[body_node_number];
          //an array to store each element values
          axis2_char_t *element[body_node_number - 1];
          //an array to store the namespace for each node
          axiom_namespace_t *name_space[body_node_number];

          //initialize the these array

          body_node[0] = "func1";
          body_node[1] ="p1";
          body_node[2] ="p2";

          element[0]="50";
          element[1]="30";


          //you can indicate the name space for each node explicitly
          //or the node is without namespace, just assign "NULL"
          name_space[0] = axiom_namespace_create(env,
                        "http://www.querix.com/test";,
                        "ns1");
          name_space[1]= NULL;
          name_space[2] = NULL;

          //call the build_SOAP_body function to build SOAP body
          payload = build_SOAP_body(env, body_node, element, body_node_number, 
name_space);

          //check whether the payload has been successfully built
          if(!payload)
          {
              printf("failt ot build to payload\n");
              return 0;
          }

          /*
           * The following one to build attachment.
           */

          //the acutal number of attachment files
          int attachment_number = 3;

          //an array to store the file name and path name of each attachment
          //MAX_ATTACHMENT is defined in "axis2.h"
          axis2_char_t *attachment_file_name[MAX_ATTACHMENT];

          //an array to store the content type of each attachment
          //e.g., "text/plain", "text/html"
          axis2_char_t *content_type[MAX_ATTACHMENT];

          //initilize the these array
          attachment_file_name[0]="1.txt";
          attachment_file_name[1]="3.txt";
          attachment_file_name[2]="2.txt";


          content_type[0]="text/plain";
          content_type[1]="text/plain";
          content_type[2]="text/plain";


          //Attach these file into SOAP
          build_SOAP_attachment(env, payload, attachment_file_name, 
content_type, attachment_number);


/*
 * send the SOAP message to the web service
 */

        axiom_node_t *return_node = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, 
env, payload);


        //if return node is NULL, there is something wrong in your payload
        //e.g., wrong operation name, wrong number of parameters, wrong 
datatype of parameter
        if(!return_node)
        {
            //add your code here to deal with the error
            printf("there is something wrong, pls check operation name, 
parameter number and value\n");
            return 0;
        }
        else
        {

              //the number of result you expect to receive
              const int expected_number_of_result = 2;

              //an array to store result value
              axis2_char_t *result_value[expected_number_of_result];

              //an array to store return attachment file name and path name
              axis2_char_t *receive_attachment_name[MAX_ATTACHMENT];

              //the variable will be used to store the actual number of 
attachments
              int return_attachment_number = 0;

              axiom_node_t *last_result_node = deserialize_SOAP(env, 
return_node,
                           result_value, expected_number_of_result);

              if(!last_result_node)
              {
                  //the number of return result is not same as the number
                  // the user expected, add the code to deal the error
                  printf("there is unmatach result number\n");
                  return 0;
              }
              else
              {
                  return_attachment_number = deserialize_attachment(env,
                                           last_result_node, 
receive_attachment_name);

                  //add the code to deal with results
                  //e.g., convert result value to correspond native datatype, 
etc
printf("return attachment number is: % d\n", return_attachment_number);

              }

        int i;
        for(i = 0; i < expected_number_of_result; i++)
           printf("result value is : %s\n", result_value[i]);
        printf("attachment is :%d\n", return_attachment_number);

        }

 return 1;
}



#include <axiom.h>
          #include <axis2_util.h>
          #include <axiom_soap.h>
          #include <axis2_client.h>

#define MAX_ATTACHMENT 5

axis2_env_t *
createEnvironment(axis2_char_t* log_file);




axiom_node_t *
build_SOAP_body(const axis2_env_t *env,
        axis2_char_t *node_name[],
        axis2_char_t *element_text[],
        int number_node,
        axiom_namespace_t *name_space[]);


void build_SOAP_attachment(const axis2_env_t *env,
        axiom_node_t *root_node,
        axis2_char_t *attachment_file_name[],
        axis2_char_t *content_type[],
        int attachment_number);


axiom_node_t* deserialize_SOAP(const axis2_env_t *env,
        axiom_node_t *node,
        axis2_char_t *element_value[],
        int expect_element_number);




 int deserialize_attachment(const axis2_env_t *env,
        axiom_node_t *node,
        axis2_char_t *attachment_file_name[]);

Attachment: libtest.so
Description: application/apachemodule

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to