Unfortunately, Active Cast can't really be used for what you want to do. Our Active Cast calls support a small number of simple requests and return simple, static HTML. The main purpose of this is to easily display dynamic content on existing web sites without the customer needing to have much technical knowledge.
For a more complex, custom project like you are looking at undertaking, I would suggest using the REST API instead. It has a much larger number of calls/options and returns plain XML with which you can do whatever you like.