supppose we have a webservice A and a method A.x(). whenever we call A.x(),
A will return something to us. However, when we don't call A.x(), is there
any way that A can run autonomous by itself and change its data? I just
wonder how we could do this....

here is one architecure I can think of

Client <----> webservice A <---> Database <----> [a program B]
a program B, running somewhere, will modify the data of A in the database.
so that we can have something (but not A) running autonomous and changing
the data of A.

however, I just wonder if we can integrate B into A so that we can have like
a thread running at the same time the client request A.x(). then we can
also remove the database also.
Client <---> webservice A(method x, and B)

any opinion is welcomed.