I've tried to reproduce your problem in the recently released Worklight 6.0, and I see everything working fine, after a copy&paste of your code.
The only change I did was to add the empty parameters on the invocationData object used to invoke the adapter method.
This is my exact code:
FileIOPlugin.java (under server/conf, in a package com.worklight.javacode)
package com.worklight.javacode;
public class FileIOPlugin {
public static String getXML() {
return "SUCCESS";
}
}
JavaAdapter.xml (HTTP adapter definition, under adapters folder)
<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="JavaAdapter"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wl="http://www.worklight.com/integration"
xmlns:http="http://www.worklight.com/integration/http">
<displayName>JavaAdapter</displayName>
<description>JavaAdapter</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>rss.cnn.com</domain>
<port>80</port>
<!-- Following properties used by adapter's key manager for choosing specific certificate from key store
<sslCertificateAlias></sslCertificateAlias>
<sslCertificatePassword></sslCertificatePassword>
-->
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="getXML"/>
</wl:adapter>
JavaAdapter-impl.js (next to JavaAdapter.xml)
function getXML() {
return {
result : com.worklight.javacode.FileIOPlugin.getXML()
};
}
I called my app javaAdapterApp, hence these file names:
javaAdapterApp.js (under apps/javaAdapterApp/common/js)
function wlCommonInit(){
}
function getXML() {
var invocationData = {
adapter : 'JavaAdapter',
procedure : 'getXML',
parameters : []
};
WL.Client.invokeProcedure(invocationData, {
onSuccess : successHandler,
onFailure : failureHandler
});
}
function successHandler(data) {
alert(JSON.stringify(data));
}
function failureHandler(data) {
alert("Error to get data");
}
And finally
javaAdapterApp.html (under apps/javaAdapterApp/common)
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>javaAdapterApp</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<link rel="shortcut icon" href="images/favicon.png">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="stylesheet" href="css/javaAdapterApp.css">
<script>window.$ = window.jQuery = WLJQ;</script>
</head>
<body id="content" style="display: none;">
<button onClick="getXML()">GET XML</button>
<script src="js/initOptions.js"></script>
<script src="js/javaAdapterApp.js"></script>
<script src="js/messages.js"></script>
</body>
</html>
I ran it in the test server, and the result of JSON.stringify(data) in the success handler looks like:
{"status":200,"invocationContext":null,"invocationResult":{"responseID":"9","result":"SUCCESS","isSuccessful":true}}
There is the "SUCCESS" String you are looking for in the invocationResult.result.
Hope this helps
Orlando