You could follow the example in section "13.2.4. Executing service nodes" of the same chapter. If your process execution reaches a service node, and you have registered a handler for it, the handler's executeWorkitem method is invoked. At that point you are doing just Java code so you can have it do what you wish.