I am currently writing some Java macros for Writer. Those macros are using the Axis API to access some web services (locally right now for test purpose). All the required dependencies are packed in the .odt file.
The matter is that when I execute a macro (one of those using some web services) it takes about 50 seconds to display a result (the expected result, at least...), while OOo is completely stunned.
On the other side, the same macro code completes in less that 1 second when executed outside OOo (under Eclipse for instance).
Some tests showed me that all the calls to the Axis library take about 20 seconds to complete when ran under OOo :/
a code sample :
Code: Select all
public static void tryWS(XScriptContext xScriptContext) throws Exception, ServiceException, RemoteException {
String output = "";
// Using Axis generated classes (taking about 20secs under OOo)
BureautiqueService bs = new BureautiqueServiceLocator();
BureautiqueServicePortType port = bs.getBureautiqueServiceHttpPort();
// WebService call (taking about 30secs under OOo)
String[] res = port.lireSections();
// Packing results in a single string
for (String elem : res) {
output += elem + "\n";
}
// Now printing the result in a Writer opened document
XModel xDocModel = xScriptContext.getDocument();
// getting the text document object
XTextDocument xtextdocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xDocModel);
XText xText = xtextdocument.getText();
XTextRange xTextRange = xText.getEnd();
xTextRange.setString("\nRésultat de l'appel de 'lireSections()' :" + "\n" + output);
}
Can anyone help me on that trick ?
Thanks by advance.