Getting joint posiitions for URCAPS

I’m building a URCAP for my own customized movej node. I’m trying to get the joint positions using .getAllJointPositions() from the jointPosition class. But some times this value does not correspond with the one given the the RTDE server or the 30002 port server. In fact, when I introduce these values in the movej urscript function, the robot tries to move beyond its joint limits. The same happens with getAngle method. Its seems that the values are shifted by 2*pi.
There is a formal way to call these functions in order to avoid these problems?