I askd the same question some months ago and the answer was that there is no easy solution for that. Either you want to wait for GlassFish 3.x which comes with a new annotation for that, or you can implement a JAX-WS WebService and ask that one for it's endpoint's address. I did a third way: I added ask my own session bean "getBaseAddress()" which I implemented on my own by simply returning a custom resource string that the administrator has to set at deployment time. Not nice, but done in few minutes.
Regards
Markus