This is the first steps in the guide to creating third party applications that will utilize the CA ARCserve RHA Control Service API for Creation, Modification, and Control of CA ARCserve RHA scenarios of all types. This guide will primarily concentrate on API programming within C++ and C# .NET applications using the Microsoft Visual Studio IDE.
For additional IDE's please refer to their documentation and guides to utilize a 'Web Reference' when programming your application.
Setting up the environment:
The first step to getting started with creating your application using this guide will have the following requirements:
- CA ARCserve RHA Control Service Installation files
- A working Microsoft Visual Studio IDE environment of at least version 2005 or greater
- Microsoft .NET 2.0 Framework
- C++ / C# .NET programming experience
- Working knowledge of utilizing the CA ARCserve RHA Manager for scenario control
Step 1 - Control Service Installation:
You will need a server that has the CA ARCserve RHA Control Service installed on it. Please follow the below link for the documentations on how to perform the installation.
If you require the installation package for the current version you can obtain that from the below link.
Once you have the Control Service installed you will need to note the hostname, fqdn or IP address of that machine in order to connect to the API later on.
Step 2 - Using Microsoft Visual Studio to connect to the API
Prior to this make sure that you have Microsoft Visual Studio .Net installed along with .NET 2.0 Framework.
For the purposes of this guide we will be creating a C# .NET Windows Application that has a number of functions for creating a couple of scenario types and also perform some control for each of those scenarios including gathering data and statistics.
So starting off we will create a Windows Application project using the project name 'rha_api_test'.
Once created we will need to add in a Web Reference into the project in order to connect to the Control Service API. To do this in the solutions explorer on the right hand side of the IDE right-click on 'References' and then click on 'Add Web Reference...'
Then you will need to point the URL http://control-service-name:8088/ws_man/xosoapapi.asmx or http://control-service-IP:8088/ws_man/xosoapapi.asmx to the Control Service hostname, fqdn or IP address to connect to the API like below and then click GO.
You may need to utilize the https://control-service-name:443/ws_man/xosoapapi.asmx or https://control-service-IP:port/ws_man/xosoapapi.asmx link if SSL is enabled on the Control Service host.Please note that you will need to make sure that whatever hostname or IP that you use must match the common name found within the certificate associated with the Control Service installation.
Once you have assigned a reference name for use in the project click 'Add Reference', in our example we are using CSReference. You will notice that the methods available within the API are below the URL in the above screen.
Next we will add a simple button, two labels and 2 textboxes for input of Username and Password.
- Text box objects: cs_user & cs_pass
- Button object: connect_btn
- These are auto created within Form1.Designer.cs
private System.Windows.Forms.Button connect_btn;
private System.Windows.Forms.TextBox cs_user;
private System.Windows.Forms.TextBox cs_pass;
Now let's add some code to the Connect button by double clicking on the button in the form designer.
Once in the 'view code' mode we can now apply our basic requirements for creating a session to the API and connecting/authenticating to specified the Control Service.
First we will need to include the following references:
using System.Xml; // used for manipulation and navigation of the scenario XML nodes
using System.IO; // used for basic IO in this particular example
Then at least two private variables:
private const string XmlDeclaration = '';
private CSReference.xosoapapi_c cs_session;
We then can use the information from the form to create an instance of the Web Reference for a session and create a connection to the Control Service with this information.For this we use the following API method call: CSRHAWebReference.create_session
Once you run and build this you can see the following output:
Now that we have an established connection with the Control Service the instance of cs_session can be used with other methods found within the API for scenario creation, control and configuration.We will continue with that in the next portion of the guide where we begin to create scenarios.
Attached is the Visual Studio 2005 example that was used in this lesson. Once opened the Web Reference IP address will need to be changed to the server that you have installed the CA ARCserve RHA Control Service onto in order to work.
Please find more information on the CSRHAWebReference methods at CA ARCserve RHA CS Web Service API Reference Index