Write a as an/ad (numerator over denominator), and b as bn/bd. Follow along as we do some algebra. The second step multiplies top and bottom by something in R, and this works only because R is an integral domain.
aw(b) =
adbd aw(b) over adbd =
bdanw(b) over adbd =
bdw(anb) over adbd =
w(anbn) over adbd
The last expression is symmetric in a and b, so the same algebra applies to bw(a), and we have aw(b) = bw(a).
This assumes a and b are both in H.