Friday, April 27, 2007

X-WSSE UsernameToken timed out


A couple of days ago, our web service retrieving data from Movable Type server using the ATOM API, started not to work. The web service was in a different server and nothing was changed. Both servers were in the same network.

The status of the error was 403 (Forbidden) and the status code was
"X-WSSE UsernameToken timed out".


We found out that there was 2.5 minutes time difference between the servers.
Then I checked Movable Type's scripts from the link below:

http://www.dankohn.com/mt/lib/MT/AtomServer.pm

........................
use constant TIMEOUT_WINDOW => 120;
.........................

# xxx Expire sessions on shorter timeout?
my $user = MT::Author->load({ name => $auth->{Username} })
or return $app->auth_failure(403, 'Invalid login');
my $created_on_epoch = $app->iso2epoch($auth->{Created});
if (abs(time - $created_on_epoch) > TIMEOUT_WINDOW) {
return $app->auth_failure(403, 'X-WSSE UsernameToken timed out');
}


As it is seen, the time out value is set to 120 seconds. Since the servers were not sycnhed, the request was timing out.

No comments: