Hi,

I am using xmlToList() in a loop with a call to a webservice, per the code 
below.  

  # Loop thru target locs
  for(i in 1:num.target.locs) {
    url <- paste(sep="/", "http://www.earthtools.org/timezone";, lat[i], lon[i])
    tmp <- xmlToList(url)
    df$time.offset[i] <- tmp$offset
    system("sleep 1")  # wait 1 second per requirements of above web service
  }  # end loop thru target locations

Failure struck midway through my loop, with the message below.

failed to load HTTP resource
Error: 1: failed to load HTTP resource

I presume that the webservice failed to respond in this instance.  How can I 
trap the error and have it retry after waiting a second or two, instead of 
exiting?

Thanks.  --Scott Waichler
Pacific Northwest National Laboratory
Richland, WA, USA
scott.waich...@pnnl.gov

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to