Since there is no such thing as a scheduled server-side javascript agent, I want to use a scheduled LotusScript or Java agent to periodically call a XAgent, i.e. call the XAgent's url. In LotusScript, the code of the agent (initialize) looks like this:
Dim w As New NotesUIWorkspace
w.Urlopen "http://domain/db.nsf/XAgent.xsp"
When I directly call the XAgent's url (in the browser), it is executed succesfully. Yet, the XAgent is not executed when I call it using the agent above. Can anybody tell me what i'm doing wrong and/or provide another solution, like for example a Java agent?
If you go for Java agent, you can always use java.net.* classes to open an URL, or use Apache HTTP client library.
See http://docs.oracle.com/javase/6/docs/api/java/net/URL.html for reference.
Related
I need to make a call to a HTTPS based service, from LotusScript.
Previously, I have used:
Set http = CreateObject("Msxml2.ServerXMLHTTP.3.0")
But now we have moved the application to a Domino server on Linux.
My first attempt to replace this code, was to call the shell function, with a call to curl. It works, but the shell function always return an integer, so the response is transferred back to LotusScript as temporary files. The curl solution is rather slow. Approximately 2 seconds response time is too long. The MsXml solution responded in 170 ms!
Then, to get rid of the temporary files, I tried using libcurl, but it requires a callback method to receive the response. It is my understanding that LotusScript is unable to pass callback methods to native methods.
The next attempt was using LS2J to make the HTTP request from Java. It worked, but with a response time of more than 6 seconds, it is useless for our application.
How can I call an external API from LotusScript on Linux, with descent performance?
#IBM: Can we please have a HTTP client and a JSON parser in LotusScript?
LotusScript can declare and call functions in external C libraries, which I suppose you already know from trying to use libcurl. What you can do is write your own C library which acts as a front-end to libcurl. Your C code will have to provide the callback and wait for it to handle the result so you can pass it back to your LotusScript.
I'd suggest to get rid of LS and do what you need to do in Java. In Java you have native libs for http. Or you can use callbacks from C when you use JNA
I'm creating TestNG tests for Java classes that are normally used from Xpages application. Since they have to call some legacy LotusScript code, I have to use agent.runWithDocumentContext call.
From Xpages this runs fine. But when I call this method from TestNG suite run from Domino Designer, I get
NotesException: Unable to pass doc context - Caller must run with user authority
I create session normally using NotesFactory.createSession()
Database is on test server and agent has Run As Web User property set, since it is called correctly form xpages in the app.
Everything runs on 9.0.1 Domino
This might give you a hint how to solve your problem, to get your code to run in a user context.
I want my Domino Servlet to get an authenticated user session
In my application i need to use tropo application with node.js to send,receive message and call and answer phone calls.I saw the documentation but i didn't get any idea.Can anyone help me.
Disclaimer - I have never worked with tropo, but this is how I understand it works:
You write a script that tropo can parse, in most languages, to perform some function.
You link up that script to a number using tropo's web interface.
You / a client phones that number, tropo fetches your script and executes it.
Here is a full walkthrough of how everything above works: https://www.tropo.com/docs/scripting/creating_first_application.htm
NOW, if you want your script to do dynamic things, you need to host it yourself. For this you can use node.js:
You write a script that changes based on time / user data in node.js
You link up the script using tropo's web interface.
When someone calls / texts the number, tropo now fetches the dynamic script from your node.js server.
This node.js api can be used to write scripts on your node server: https://github.com/tropo/tropo-webapi-node, https://www.tropo.com/docs/webapi/new_tropo_web_api_overview.htm
Finally, you might want to dynamically create different scripts for different users and hook them up to individual numbers. At this point you use the REST API to automate the "number hooking up work" you used to have to do manually on tropo's website. You can use any node REST client, like request to do this. Here are the API docs: https://www.tropo.com/docs/rest/rest_api.htm
I am launching requests to a web service using Groovy/XmlSlurper:
new XmlSlurper().parse("http://en.wikipedia.org/w/api.php?action=...")
I would like to set the user agent to let the website know what project the requests are from.
How to set the user agent?
XMLSlurper's constructors do not have anything like this.
The setProperty method sounds interesting but Google does not lead to anything related to UA.
I would rather avoid changing the code to abandon XmlSlurper in favor of another library.
Looks like Groovy uses the JVM's default SAX parser to connect to the input stream and perform the initial parsing. I saw this answer on SO that might help - all you need to do is set this before your call to the slurper to make it happen:
System.setProperty("http.agent", "my-agent-name");
P.S. This is just a guess - hope it helps.
I see p.3, btw there is also Groovy Http Builder, it uses JsonSlurper for JSON results, but it's much more flexible for making http requests - http://groovy.codehaus.org/HTTP+Builder
I am working on code for a webserver.
I am trying to use webhooks to do the following tasks, after each push to the repository:
update the code on the webserver.
restart the server to make my changes take effect.
I know how to make the revision control run the webhook.
Regardless of the specifics of which revision control etc. I am using, I would like to know what is the standard way to create a listener to the POST call from the webhook in LINUX.
I am not completely clueless - I know how to make a HTTP server in python and I can make it run the appropriate bash commands, but that seems so cumbersome. Is there a more straightforward way?
Setup a script to receive the POST request ( a PHP script would be enough )
Save the request into database and mark the request as "not yet finished"
Run a crontab and check the database for "not yet finished" tasks, and do whatever you want with the information you saved into database.
This is definately not the best solution but it works.
You could use IronWorker, http://www.iron.io, to ssh in and perform your tasks on every commit. And to kick off the IronWorker task you can use it's webhook support. Here's a blog post that shows you how to use IronWorker's webhooks functionality and the post already has half of what you want (it starts a task based on a github commit): http://blog.iron.io/2012/04/one-webhook-to-rule-them-all-one-url.html