Saturday, 9 March 2013

How to use Node.js with WebLogic OSB

I recently came across a situation where there was a requirement to use WebLogic OSB configuration in a Node.js application. The information in question was the Endpoint URIs for all Business Services found in the OSB.
Since WebLogic removed "ServiceConfigurationMBean" from WLST in 11g, writing a Python script as you normally do was out of the question. Using Java was the only possibility at this stage, but it felt a bit much writing a new app just for a simple task like this.

This is when a college pointed me to which is a module to write native Java which is then executed inside your javascript using Node.js.

It turned out to be very straight forward and I added a sample JavaScript here:

In order to run the script, you will need Node.js, Java and some WebLogic libraries.
The WebLogic libraries been specified in the getbs.js file as:
Copy those files to the current working directory and update any version numbers as necessary.

Next, define your connection options:
var config = {
        admin_server: {
            "hostname": "",
            "port": 9001,
            "username": "weblogic",
            "password": "w3blogic"

And then run it:
node getbs.js

If all goes well, it will output something similar to this:
qwerty/business_services/qwerty_bs       =>