How to manage opennebula-sandbox using API

Hi all!!
I’m using the opennebula sandbox on virtualbox…I’d like to manage VMs with a java program using API…
I downloaded OCA and started programming but I don’t know how to communicate with the sandbox on virtualbox
Thank you

we use oca to connect to opennebula with xmlrpc with this address: http://IPORHOSTNAME:2633/RPC2
check your sandbox networking type and find your ip address to connect to opennebula .

1 Like

Hi thank you for your reply!!
In virtualbox settings I setted the network to NAT and as suggested in the sandbox guide I forwarded ports 9869 to 9869 and 29876 to 29876.
I am using Ubuntu 14.04 to execute virtualbox and to execute the java program wich will control the sandbox
if in the browser I enter localhost:9869 it opens sunstone page… instead if i put localhost:29876 it says:
Error response
Error code 405.
Message: Method Not Allowed.
Error code explanation: 405 = Specified method is invalid for this resource…

when you say

you mean virtualbox network settings?

yes in both Nat and Bridge you have one IP address for your machine . to connecting to api you have to use virtual machine ip address : http://machineipaddress:2633/RPC2
another way that im not testing it yet is forwarding 2633 port using virtuabox forwarding setting . after that maybe you can connect to api using http://localhost:2633/RPC2

1 Like

thank you for your reply
I portforwarded 2633 to 2633 quickly and now when i browse to http://localhost:2633 i get

Error 404

This XML-RPC For C/C++ Abyss XML-RPC server responds to only one URI path. I don't know what URI path that is, but it's not the one you requested: '/'. (Typically, it's '/RPC2')

ABYSS Web Server for XML-RPC For C/C++ version 1.33.6

if I put http://localhost:2633/RPC2 in the browser I get
Error 405

POST is the only HTTP method this server understands

ABYSS Web Server for XML-RPC For C/C++ version 1.33.6

I’m on the right way?

yes now you can now start using api :slight_smile:

1 Like

Thank you
next step…
I am trying the code sample from this page
what I have to do to use XRPC?
before the sample code I put these imports

import org.opennebula.client.Client;
import org.opennebula.client.vm.VirtualMachine;
import org.opennebula.client.OneResponse;
import org.apache.xmlrpc.client.XmlRpcClient;

if i compile it i get

ONE_AUTH file not present

How can i set the $ONE_AUTH path?
I’m executing the program on netbeans and openenbula is running on virtualbox…


1 Like

ONE_AUTH can be an environment variable with this format
export ONE_AUTH=oneadmin:password
or a file ~/.one/one_auth contains oneadmin:password


Hi capvt,
How did you execute the program that uses the opennebula API ?
Did you use any server such as Tomcat ?
which type of program did you write (e.g., java program pr dynamic program or spring boot program)?

1 Like