You can start OpenOffice in listening mode with e.g. this command:
soffice -accept=socket,host=localhost,port=8100;urp;
This commandline starts OpenOffice listening on port 8100
This snippet connects to a listening OpenOffice and creates a wordprocessor document.