Axis2-C
  1. Axis2-C
  2. AXIS2C-626

client fires error on synchronous calls of longer duration

    Details

      Description

      we use the axis2/c library to implement a WS client that executes synchronous calls (via axis2_svc_client_send_receive).

      When the webservice needs a little time to return the response (it is indeed under one second), the axis2/c API fails with the following error:
      errorNr = 82
      errorText = Input stream is NULL in msg_ctx

        Activity

        Hide
        Manjula Peiris added a comment -

        Thanks Juergen for pointing out this.

        Show
        Manjula Peiris added a comment - Thanks Juergen for pointing out this.
        Hide
        Juergen Haeussler added a comment -

        We recently found the problem in the network_handler.c:
        The windows API expects timeouts for sockets in milliseconds as a DWORD value (as you can see in API documentation of setsockopt/SOL_SOCKET).
        In the Axis code it was set to seconds by using a timeval struct:

        AXIS2_EXTERN axis2_status_t AXIS2_CALL
        axutil_network_handler_set_sock_option(const axutil_env_t *env, axis2_socket_t socket,
        int option, int value)
        {
        if (option == SO_RCVTIMEO || option == SO_SNDTIMEO)

        { struct timeval tv; /* we deal with milliseconds */ tv.tv_sec = value / 1000; tv.tv_usec = (value % 1000) * 1000; setsockopt(socket, SOL_SOCKET, option, (char*) &tv, sizeof(tv)); return AXIS2_SUCCESS; }

        return AXIS2_FAILURE;
        }

        So we changed this method to the following code and now everything works well:

        AXIS2_EXTERN axis2_status_t AXIS2_CALL
        axutil_network_handler_set_sock_option(const axutil_env_t *env, axis2_socket_t socket,
        int option, int value)
        {
        if (option == SO_RCVTIMEO || option == SO_SNDTIMEO)

        { #if defined(WIN32) DWORD tv = value; //windows expects milliseconds in a DWORD #else struct timeval tv; /* we deal with milliseconds */ tv.tv_sec = value / 1000; tv.tv_usec = (value % 1000) * 1000; #endif setsockopt(socket, SOL_SOCKET, option, (char*) &tv, sizeof(tv)); return AXIS2_SUCCESS; }

        return AXIS2_FAILURE;
        }

        Please transfer this change to the source repository that it will be included in subsequent versions of Axis2/C.

        Thanks

        Show
        Juergen Haeussler added a comment - We recently found the problem in the network_handler.c: The windows API expects timeouts for sockets in milliseconds as a DWORD value (as you can see in API documentation of setsockopt/SOL_SOCKET). In the Axis code it was set to seconds by using a timeval struct: AXIS2_EXTERN axis2_status_t AXIS2_CALL axutil_network_handler_set_sock_option(const axutil_env_t *env, axis2_socket_t socket, int option, int value) { if (option == SO_RCVTIMEO || option == SO_SNDTIMEO) { struct timeval tv; /* we deal with milliseconds */ tv.tv_sec = value / 1000; tv.tv_usec = (value % 1000) * 1000; setsockopt(socket, SOL_SOCKET, option, (char*) &tv, sizeof(tv)); return AXIS2_SUCCESS; } return AXIS2_FAILURE; } So we changed this method to the following code and now everything works well: AXIS2_EXTERN axis2_status_t AXIS2_CALL axutil_network_handler_set_sock_option(const axutil_env_t *env, axis2_socket_t socket, int option, int value) { if (option == SO_RCVTIMEO || option == SO_SNDTIMEO) { #if defined(WIN32) DWORD tv = value; //windows expects milliseconds in a DWORD #else struct timeval tv; /* we deal with milliseconds */ tv.tv_sec = value / 1000; tv.tv_usec = (value % 1000) * 1000; #endif setsockopt(socket, SOL_SOCKET, option, (char*) &tv, sizeof(tv)); return AXIS2_SUCCESS; } return AXIS2_FAILURE; } Please transfer this change to the source repository that it will be included in subsequent versions of Axis2/C. Thanks
        Hide
        Juergen Haeussler added a comment -

        No I didn't yet. Which options should I set (and how can I do that)?
        I recently traced into the axis sources with the debugger and recogniced that per default the timeout is set to 60000 ms. Isn't that enough?

        Show
        Juergen Haeussler added a comment - No I didn't yet. Which options should I set (and how can I do that)? I recently traced into the axis sources with the debugger and recogniced that per default the timeout is set to 60000 ms. Isn't that enough?
        Hide
        Samisa Abeysinghe added a comment -

        Did you try setting the timeout with options?

        Show
        Samisa Abeysinghe added a comment - Did you try setting the timeout with options?
        Hide
        Juergen Haeussler added a comment -

        There are some lines with log level error. There you'll see that the API thinks there's no response from the WS.

        Show
        Juergen Haeussler added a comment - There are some lines with log level error. There you'll see that the API thinks there's no response from the WS.

          People

          • Assignee:
            Manjula Peiris
            Reporter:
            Juergen Haeussler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development