RMGHelp needed

once say a sample 850 hits our tN we write processing rule to invoke a service known as process dos.process doc has the following flow in it

  1. get contacts of partner
    2)envelope process and…
    My requirement is i have to code the service get contacts of partners.the output of this service should be e-mail addresses of the Sender.I need these details to inform the sender if the envelope process fails.Please tell me how can i create this service.Thanks in advance.