It works.
This is how it looks if anyone else is having the same problem:
IData Doc1_1 = IDataFactory.create();
IDataCursor Doc1_1Cursor = Doc1_1.getCursor();
IDataUtil.put( Doc1_1Cursor, "in", "This is the input string" );
Doc1_1Cursor.destroy();
IData Doc1_0 = IDataFactory.create();
IDataCursor pipelineCursor_1 = Doc1_0.getCursor();
IDataUtil.put( pipelineCursor_1, "Doc", Doc1_1 );
pipelineCursor_1.destroy();
IDataCursor resultPipeline = accessFlowService(Doc1_0).getCursor();
String output = IDataUtil.getString(resultPipeline, "out");
The name of the output variable in the flow service is “out”.
And this is accessFlowService function that is being called.
static IData accessFlowService(IData input) {
IData result = null;
try {
result = Service.doInvoke("Sandbox.peturj.CallFlowFromJavaservice", "SingleInput", input);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
Thanks for the answer 
#Integration-Server-and-ESB#webMethods#webMethods-General