0

I had a WSDL file then I used AXIS2C WSDL2C tool to create the client project.

I modified the axis2.xml file. added this line in the beginning after <axisconfig name="Axis2/C">:

<parameter name="SO_TIMEOUT">8000</parameter>

I can now set the timeout. How can I handle it in my code? I mean How can I know that I've got a connection timeout or a socket timeout or the server responded properly.

Question Update: here is a link to my project :

Sarah Aziziyan
  • 498
  • 9
  • 22

1 Answers1

0

You should analyze error code from env->error->status_code after you invoke the client:

axiom_node_t* resp = axis2_svc_client_send_receive(client, env, payload);

switch (env->error->status_code)
{
case AXIS2_ERROR_RESPONSE_TIMED_OUT:
  // Timeout
    break;

// other errors goes here ...
}

Also if you want to set timeout programmatically:

axis2_options_t* opt = axis2_options_create(env)
axis2_options_set_timeout_in_milli_seconds(opt, env, 8000);
axis2_svc_client_set_options(client, env, opt);
loentar
  • 5,111
  • 1
  • 24
  • 25
  • Hello. where should I put the first piece of code? should I put it in the main.c ? should I create all the parameters (svc_client, env, payload) ? I've edited the question and included a link to my project. It would be very nice of you to tell me what to do. – Sarah Aziziyan Mar 10 '15 at 08:02
  • As I see you're using ADB. There is no way to get error code when you're using adb unless you modify the generated stub by hand. Search "axis2_svc_client_send_receive_with_op_qname" in your generated 'axis2_stub_MathService.c' and try to add the switch/case there. – loentar Mar 10 '15 at 09:01
  • can you clarify a little bit please? I can't seem to find a good solution and I really need to handle the timeouts. @loentar – Sarah Aziziyan Mar 14 '15 at 07:27
  • 1. open your 'axis2_stub_MathService.c' in any text editor; 2) search for `axis2_svc_client_send_receive_with_op_qname` 3) after found line add swith/case as in my example; 4) implement the code within `case AXIS2_ERROR_RESPONSE_TIMED_OUT:` – loentar Mar 15 '15 at 09:47