I am not sure I understood well the question but I hope this answer could help you. Usually in Jolie we proceed as follows:
- the logic (the one which should be replicated) is served by one microservice (which could be embedded or deployed separately, it doesn't matter). Let me call it L.
- the other entities which requires that logic just invoke the microservice L
- in the case of the web app, we use Leonardo (
http://sourceforge.net/projects/leonardo/), which is a web server written in pure Jolie, we public the calls to L by simply adding them in few lines of code through aggregation. In this case Leonardo, which serves the http protocol, just take the message, transform it in another protocol (we usually exploit sodep for Jolie to Jolie communication) and redirect the message to L which exectues the logic.