Hi Antonino,
the JavaScript support in TopBraid's SPINx feature is based on Mozill
Rhino, so the first thing to check would be whether Rhino supports such
http requests. My second suspicion is that the function below would not
work because it doesn't block on read - it sends out the request and
then finishes, while the return statement is in a callback that is
called asynchronously. So overall I don't think JavaScript would work
for your scenario.
To issue GET requests as part of SPARQL functions, you have several
other options, including definition of functions using SPARQLMotion
(which can then call sml:PostRequest or sml:ImportTextFromURL etc) and
functions based on SWP. But these require TBC-ME (I can provide details
if you can confirm that TBC-ME is an option for you).
The ultimate fallback is to use SPARQL functions based on Java, against
the Jena API. Details can be found at
Extending TopBraid Suite > Adding SPARQL Functions to TopBraid
in the TBC Help.
HTH
Holger
On 4/22/2015 19:12, [email protected] wrote:
Hi all,
Im wondering if is possible to implement an AJAX GET or POST call
inside a SPINx function.
I tried this but is not working:
var url = MYLOCALURL
var params = MYPARAMS;
http.open("GET", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Content-type",
"application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {//Call a function when the state
changes.
if(http.readyState == 4 && http.status == 200) {
return (http.responseText);
}
}
http.send(params);
Also wondering if we can implement JAVA code using SPINx
Thanks
Antonino Lo Bue
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise
Vocabulary Network (EVN), Reference Data Manager (RDM), TopBraid
Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web
Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google
Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Group "TopBraid
Suite Users", the topics of which include Enterprise Vocabulary Network (EVN),
Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, TopBraid Insight,
SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.