VMware vSphere Web Services API - list cluster host/Get

Hello

How can I get all the details of host(ESX/ESXi) /cluseter of VMware vCenter Server?

I am beginner in developing this kind of client application VMware.

Suggest me a way to develop this kind of application.

Thank you

D V

So you will actually need a traversal spec for ComputeResource.  It also will pick up your hosts in cluster as well.

You will need to add the following:

ns1__TraversalSpec ComputeResourceTraversalSpec;

ComputeResourceTraversalSelectionSpec.name = new string("ComputeResourceTraversalSpec");

ComputeResourceTraversalSpec.name = new string("ComputeResourceTraversalSpec");
ComputeResourceTraversalSpec.type = "ComputeResource";
ComputeResourceTraversalSpec.path = "host";
ComputeResourceTraversalSpec.skip = &xsd_true;

FolderTraversalSpec.selectSet.push_back(&ComputeResourceTraversalSelectionSpec);

ObjectSpec.selectSet.push_back(&ComputeResourceTraversalSpec);

That will allow you to cross the file to the folder data center to calculate hostsystem resources.

I tested it on my end to be sure, and it works.

Tags: VMware

Similar Questions

  • The implementation of RunProgramInGuest of VIX using the vSphere Web Services SDK?

    Hello

    A few months ago I developed a python API for VIX, but as I needed to extend the functionality of this API (performance monitoring, host management, etc.) I moved the vSphere Web Services SDK.

    However, I did find a way to implement some comments VIX as LoginInGuest or RunProgramInGuest functions using only the Web Services SDK.

    Is there a way to do this? I thought that each function VIX has been translated internally to a soap request, but now I think that is not the case for these functions of comments, if so, how VIX inwardly does them?

    Thanks for your help!

    Sebastian Tello

    Currently, if you must implement specific comments operations running a specific script/application or by connecting to a guest, you must use the VIX API. This feature is not currently exposed in the vSphere API, you will need to use a combination of both, until VMware them integrates in the vSphere API core. For more details on the future of VIX, take a look at this blog post - http://www.virtuallyghetto.com/2010/11/what-is-vmware-vix-api-and-its-future.html

  • What is the difference between "vShpere SDK ro Perl"and "vSphere Web Services SDK (for Java or c#)"?

    Hello world! I'm new to "VMware vSphere API", and I have a question to ask you to help:

    What is the difference between "vShpere SDK ro Perl"and "vSphere Web Services SDK (for Java or c#)"?

    -What are the different programming language? Is there another difference?

    I'm looking forward to your reply.

    Thank you!

    If you are new on the VMware API/SDK, highly recommend you take a look at the following: Getting Started with vSphere SDK - Update for SDK 4.1 release

    vSphere SDK for Perl is just one of the many client SDK for vSphere API that is flush with vcenter times and ESX (i) as a standard Web service.

    vSphere SDK for Java - SDK Java to vSphere API for Java developers

    vSphere SDK for Perl - Perl SDK for vSphere API for Perl developers

    vSphere SDK for c# - c# SDK for vSphere API for c# developers

    PowerCLI - PowerShell SDK for vSphere API for developers of Powershell

    I hope that makes a bit more sense

    =========================================================================

    William Lam

    VMware vExpert 2009,2010

    VMware VCP3, 4

    VMware VCAP4-DCA

    VMware scripts and resources at: http://www.virtuallyghetto.com/

    Twitter: @lamw

    repository scripts vGhetto

    Introduction to the vMA (tips/tricks)

    Getting started with vSphere SDK for Perl

    VMware Code Central - Scripts/code samples for developers and administrators

    VMware developer community

    If you find this information useful, please give points to "correct" or "useful".

  • BlackBerry Web Services API 10.1.3 migration

    Hi, we have a few developed internal tools that use old BES Web Services (5.0.3 / 6.2) to perform a device admin now measures via custom web pages and we will need to update these to use the new (10.1.3) web services API to perform the management of BlackBerry devices.

    Someone there done this before and don't know no easy upgrade path? Is a complete rewrite of all of our code that refers to the API, or is it an easy to follow upgrade path?

    Thank you

    John

    Hi John,.

    This should be confirmed without any code changes, BWS was written for forwards and even some backward compatibility. Just make sure you keep the version of BWS used to create the application in the METADATA of your app, in this way, the server can better understand the calls.

    If you want to add new features added to the 10.1, then you will need to re - generate proxy files, but even then your code should not continue to operate many changes.

  • Keyboard shortcuts for VMware vSphere Web Client

    Hello

    Can someone give me please the shortcuts keyboard of VMware vSphere Web Client?

    Thank you

    John

    Please follow this: http://www.vmwarearena.com/2014/09/keyboard-shortcuts-of-vmware-vsphere-web-client.html

  • Is it possible to set configuration options VMsafe via vSphere Web Service SDK?

    Is it possible to define VMsafe configuration options via the web service of vSphere SDK?

    I noticed that the options in question are 'OptionValue's contained in the property config.extraConfig of the virtual machine, so I tried to edit them using the method ReconfigVM_Task of the SOAP API.

    This fails however, even if the SOAP request appears to be valid:

    & lt;? XML version = "1.0"? & gt;

    " & lt; env:Envelope xmlns:env = ' http://schemas.xmlsoap.org/SOAP/envelope/ "& gt; .

    & lt; env:header / & gt;

    & lt; env:body & gt;

    & lt; N1:ReconfigVM_Task xmlns:n1 = "urn: vim25" & gt;

    & lt; N1:_this type = 'VirtualMachine' & gt; VM - 448 & lt; / n1:_this & gt;

    & lt; N1:spec xsi: type = "VirtualMachineConfigSpec" & gt;

    & lt; N1:extraConfig xsi: type = "n1:OptionValue" & gt;

    & lt; N1:key & gt; vmsafe.enable & lt; / n1:key & gt;

    & lt; N1: value & gt; FAKE & lt; / n1: value & gt;

    & lt; / n1:extraConfig & gt;

    & lt; / n1:spec & gt;

    & lt; / n1:ReconfigVM_Task & gt;

    & lt; / env:Body & gt;

    & lt; / env:Envelope & gt;

    This query generates the following error:

    & lt;? XML version = "1.0" encoding = "UTF-8"? & gt;

    " & lt; soapenv:Envelope xmlns:soapenc = ' http://schemas.xmlsoap.org/SOAP/encoding/ "xmlns:soapenv =" " http://schemas.xmlsoap.org/SOAP/envelope/ "container =" " http://www.w3.org/2001/XMLSchema "" xmlns: xsi = " " http://www.w3.org/2001/XMLSchema-instance "& gt; .

    & lt; soapenv:body & gt;

    & lt; soapenv:fault & gt; & lt; faultcode & gt; ServerFaultCode & lt; / faultcode & gt; & lt; faultstring & gt; invalid argument: value & lt; / faultstring & gt; & lt; retail & gt; & lt; InvalidRequestFault xmlns = "urn: vim25" xsi: type = "InvalidRequest" / & gt; & lt; / detail & gt; & lt; / soapenv:Fault & gt;

    & lt; / soapenv:Body & gt;

    & lt; / soapenv:Envelope & gt;

    For help in resolving this issue will be greatly appreciated.

    I'm glad it worked! Don't forget awareness useful or correct points

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    repository scripts vGhetto

    VMware Code Central - Scripts/code samples for developers and administrators

    http://Twitter.com/lamw

    If you find this information useful, please give points to "correct" or "useful".

  • How to get out of scheduled using web service api report

    Hello

    By using the api service report I can run the report query and get the result and save it in a file. But as I'm under the report directly I don't see report running history in BIP UI. (Or there is a way to do what I don't know.)

    So I create a task report and the request for a change it and then call using the api planning service and it works properly gives me a return identification work and I see the history for a job at the BIP UI.

    But I can't find a api that gives me the result of this work.

    All of the suggestions.

    I use eclipse, cfx to generate stubs, and it's a simple java program with access to the web service

    Obtained, he works as below.

    1. Call scheduleReport on SchedulerService to schedule a report and get the scheduled_job_id.
    2. Call getAllScheduledReportHistory on SchedulerService using scheduled_job_id to get the work history that includes the work of the child created by the Scheduler for above child_job_id scheduled_job_id.
    3. Call getScheduledJobInfo on SchedulerService using child_job_id to check whether the job has finished if it is wait for a while, then try again until the work is either successful or failed. The api returns object JobDetails
    4. If the job is successful then check if xmlDataIsAviable for the above job details. If Yes, then call getXMLData on SchedulerService using child_job_id which gives a byte array, write this array of bytes on the disk using the java.io library
    5. Call getScheduledReportOutputInfo on SchedulerService using child_job_id for the information of reportOutput, which is a list of cases
      more than one output format is specified in the report definition to the bi pub. Scan the list for the output_id for the data to the desired output format.
    6. Call getDocumentData on SchedulerService using the output_id above, which gives an array of bytes of report data, and save it using the java.io library

    If you want to avoid voting in step 3 you can configure a httpserver in bi publiher, which is basically a servlet url of a Web application deployed on a server

    Select Server Name URL Default Delete
    BiPubReportsWebApp http://hostname:PortName/webappnameWebApp/servleturi

    and when planning the report in step 1, you can specify these options in the ScheduleRequest element

    scheduleRequest.setNotificationServer (notificationHttpServerName) / /notificationHttpServerName = BiPubReportsWebApp

    scheduleRequest.setNotifyHttpWhenFailed (true);

    scheduleRequest.setNotifyHttpWhenSkipped (true);

    scheduleRequest.setNotifyHttpWhenSuccess (true);

    scheduleRequest.setNotifyHttpWhenWarning (true);

    So when the work is done bi publisher will make a post to you request httpservlet with jobid, reporturl, jobstatus, so you can use this jobid (which corresponds to the id of child labour) to perform steps 4 and following

    Another thing to note is step 6 gives the byte array return which may be huge in big reports and you can go outofmemeory in this case

    (1) request to the server to save the xml data and output on the server and returns the path where these files have been saved by using downloadXMLData and downloadDocumentData to the SchedulerService, and then tokensize the string to get the last piece

    (2) call downloadReportDataChunk of the report (in a loop) service to get the data for the xml data and the document into segments giving him the name of the file in step 1, a start index and chunksize

    While (offset! = - 1) {}

    LOG.debug ("Getting chunck number :->" + counter + "index :->" + beginIdx);

    ReportDataChunk reportDataChunk = getReportDataChunks (tmpFileNameOnServer, beginIdx, util.chunkSize);

    data = reportDataChunk.getReportDataChunk ();

    output. Write (Data);

    beginIdx = beginIdx + util.chunkSize;

    offset = reportDataChunk.getReportDataOffset ();

    counter ++;

    }

    public ReportDataChunk (String starts, int beginIdx, int size) getReportDataChunks survey com.oracle.xmlns.oxp.service.v2.reportservice.OperationFailedException_Exception,

    {com Oracle.xmlns.OXP.service.v2.ReportService.AccessDeniedException_Exception}

    ReportDataChunk reportDataChunk is getReportServicePort () .downloadReportDataChunk (starts, beginIdx, size, getUsername(), getPassword());.

    Return reportDataChunk;

    }

    Note: when you schedule a report using schedulereport pub bi api back you a job id but matching so that it creates a Collard work with a different id that does the job and this childjobid is given when using the method of notification httpserver.

  • Access to the Web Service API

    Hello

    I try to access a web page API in the APEX, but still get an error in the ACL.  I tried everything I can think of as well as the multitude of usual information "bits and pieces", which I found on the web.

    USER who needs access to the ACL and the fact that it is an https site makes a difference for settings?

    I can return data from SqlPlus without problem.

    FOR INFO.

    Oracle 11g

    APEX 5

    W2008.

    Pointers would be appreciated!

    Thank you

    Hi Samuistu,

    Samuistu wrote:

    Basically, what I want to do is to download data in a table to a Web site.  A good example of the type of data is here https://www.cryptopia.co.nz/api/GetCurrencies

    Is it possible to get this data into a table that contains the Id column headers, name, etc. of symbol.

    Assuming that you have a table as follows:

    create table crypt_currencies (
      id number,
      name varchar2(128),
      symbol varchar2(8),
      algorithm varchar2(128)
    );
    

    Finally with regard to the features to get the web service data and insert them in the table, for that you can do something like this:

    declare 
    
        l_response clob;
        l_values apex_json.t_values;
        l_data_count integer;
        l_crypt_curr_rec crypt_currencies%rowtype;
    
    begin 
    
        l_response := apex_web_service.make_rest_request (
                            p_url          => 'https://www.cryptopia.co.nz/api/GetCurrencies',
                            p_http_method  => 'GET',
                            p_wallet_path  => 'file:path/to/oracle/wallet',
                            p_wallet_pwd  => 'password' );
    
        apex_json.parse (
            p_values => l_values,
            p_source => l_response );
    
        if apex_json.get_boolean (
              p_values => l_values,
              p_path  => 'Success' ) then
            dbms_output.put_line('Success --> true');
        end if;
    
        dbms_output.put_line ( 'Data Members Count --> '||
                                apex_json.get_count (
                                    p_values => l_values,
                                    p_path  => 'Data' )
                              );
    
        l_data_count := apex_json.get_count (
                            p_values => l_values,
                            p_path  => 'Data' );
    
        for i in 1 .. l_data_count loop
    
            l_crypt_curr_rec := null;
    
            dbms_output.put_line ( 'Id --> '||
                                apex_json.get_number (
                                    p_values => l_values,
                                    p_path  => 'Data[%d].Id',
                                    p0      => i )
                                ||', '||
                                'Name --> '||
                                apex_json.get_varchar2 (
                                    p_values => l_values,
                                    p_path  => 'Data[%d].Name',
                                    p0      => i )
                                ||', '||
                                'Symbol --> '||
                                apex_json.get_varchar2 (
                                    p_values => l_values,
                                    p_path  => 'Data[%d].Symbol',
                                    p0      => i )
                                ||', '||
                                'Algorithm --> '||
                                apex_json.get_varchar2 (
                                    p_values => l_values,
                                    p_path  => 'Data[%d].Algorithm',
                                    p0      => i )
                              );
    
            l_crypt_curr_rec.id := apex_json.get_number (
                                      p_values => l_values,
                                      p_path  => 'Data[%d].Id',
                                      p0      => i );
    
            l_crypt_curr_rec.name := apex_json.get_varchar2 (
                                      p_values => l_values,
                                      p_path  => 'Data[%d].Name',
                                      p0      => i );
    
            l_crypt_curr_rec.symbol := apex_json.get_varchar2 (
                                      p_values => l_values,
                                      p_path  => 'Data[%d].Symbol',
                                      p0      => i );
    
            l_crypt_curr_rec.algorithm := apex_json.get_varchar2 (
                                      p_values => l_values,
                                      p_path  => 'Data[%d].Algorithm',
                                      p0      => i );
    
            insert into crypt_currencies
                values l_crypt_curr_rec;
    
        end loop;
    
    end;
    

    NOTE:

    • The code above is for purposes of example, if you use it make the necessary changes.
    • Dbms_output calls are given for the purpose of debugging. You can remove that in the actual code.

    I hope this helps!

    Kind regards

    Kiran

  • Call a Web Service API through VB 2005

    Hi Guyas,

    I make a call to the API via java but I don't know how I can tho that usinng VB, you have examples?

    I need help in all Login and createRequest methods

    Thank you

    Ionix V9

    It does not work because you did not what I suggested...

    What you are done (add a live web service to your project reference) is a different approach using web services, but it does not work with VSM as expected.

    The method described in VSM API guide (what I already mentioned) should work fine.

    First of all, you need not to add a direct web reference as you did in your sample.

    Just please try to do this step by step:

    • generate classes VSM (infraAPI.vb) with SvcUtil.exe [or try to use a joint].
    • Add it to your project.
    • Modify your App.config (sorry, misspelled front) by adding the serviceModel [fixing sample] section. Please change address of endpoint by your VSM server settings.
    • Add references .net:
      System.Runtime.Serialization

    System.ServiceModel

    • write your code with the following namespace imported:

    Imports System.ServiceModel

    G

    P.S. And I'm really sorry if this method does not really work in VS2005. Just can't try it now.

  • The Web Services API documentation?

    Hello


    I was looking for documentation about OLM web services, because I need to perform some simple queries from external software. You could point me please in the right direction?


    Thank you...

    Hello

    See "Oracle Learning Management Implementation Guide", Page 11-54 - publicly callable API process to OLM Business. See also «the the integration of Oracle repository User Guide»

    Application Guide Oracle Learning Management & Oracle integration repository User Guide
    http://www.Oracle.com/technetwork/documentation/applications-089559.html

    Oracle integration repository
    http://IREP.Oracle.com/index.html

    Thank you
    Hussein

  • Everyone using foam (Python) SOAP client vSphere Web Services?

    With the help of Python 2.4.3 with python-foam - 0.3.9 - 1.el5, I try RetrieveServiceContent using the following code:

    #!/usr/bin/env python
    
    from suds.client import Client
    
    import logging
    logging.basicConfig(level=logging.INFO)
    logging.getLogger('suds.client').setLevel(logging.DEBUG)
    logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)
    
    url = 'https://192.168.0.111/sdk/vimService?wsdl'
    
    client = Client(url)
    
    client.set_options(location='https://192.168.0.111/sdk')
    
    o = client.factory.create('ns0:ManagedObjectReference')
    o._type = 'ServiceInstance'
    
    result = client.service.RetrieveServiceContent(o)
    

    I get the following error...

    Debug:SUDS.client:http failed:

    Given that it is supposed to be an anonymous operation, why it fails with "the session is not authenticated '?

    So, I dug around.

    Basically what I see is that Python suds is not really wait for an XML element with an attribute and a text node.

    For example, a call to RetrieveServiceContent looks like this:

     
    
    <_this type="ServiceInstance">ServiceInstance
    
    

    Foam call ends up looking like this:

    
    
       
       
          
             
          
       
    
    

    Looks like you should be able to create your ManagedObjectReference like this:

    o = client.factory.create('ns0:ManagedObjectReference')
    o._type = 'ServiceInstance'
    o.value = 'ServiceInstance'
    

    However, it will not process it for some reason any.  It does not work:

    o = Property('ServiceInstance')
    o._type = 'ServiceInstance'
    result = client.service.RetrieveServiceContent(o)
    

    I think that you can only hit this snag with the object of foam ManagedObjectReference.  But don't hold me too it.  You can have custom create your object references managed your calls using the property class.

    Here's a working example:

    from suds.client import Client
    from suds.sudsobject import Property
    
    import logging
    logging.basicConfig(level=logging.INFO)
    logging.getLogger('suds.client').setLevel(logging.DEBUG)
    logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)
    
    url = 'https://172.16.50.11/sdk/vimService?wsdl'
    
    client = Client(url)
    
    client.set_options(location='https://172.16.50.11/sdk')
    
    mo_ServiceInstance = Property('ServiceInstance')
    mo_ServiceInstance._type = 'ServiceInstance'
    
    result = client.service.RetrieveServiceContent(mo_ServiceInstance)
    
    mo_SessionManager = Property(result.sessionManager.value)
    mo_SessionManager._type = 'SessionManager'
    
    result = client.service.Login(mo_SessionManager, 'root', 'VMware1!')
    
    print "Login Time: {0}".format( result.loginTime )
    
  • Web services and ADF 11 g - get result from backing bean

    I will carry out a backup action bean (Web service call that returns complex data types)

    BindingContainer links = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("unesiPonudu");
    Object result = operationBinding.execute ();

    instance of oracle.adf.model.adapter.dataformat.XMLHandler$ DataCollection result but DataCollection is not accessible.

    How to get the results of the method?

    TNX,

    Andreja

    Hello

    There should be a result iterator in the executable files of the article that cotnains the result. If this isn't the case, create from the result WS entry in the palette of DC. Once this iterator is updated, you get this iterator data as is the case of a table goes backwards

    Frank

  • VMware VirtuaCenter Web services management starts then stops

    The service of VMware VirtualCenter Management Webservices ended unexpectedly.  He did this 165 times.  The following corrective action will be taken in 60000 milliseconds: restart the service.

    No firewall or antivirus running.

    the port 8443 ok.

    Hello

    a possible solution to the problem you would stop "C:\Program Files (x 86) \QLogic" before starting the vcenter.



    Best regards

    Pablo

  • Should what API I use to get items in the inventory of VCServer tree?

    Hello

    I create the inventory tree (VCServer = > data center = > file = > Cluster) within a standalone dialog in my plugin. The view is ready and it works on an XML string that represents the hierarchy of objects (tested with simulated data) tree. Now I need objects real vSphere appears in my tree, and I was wondering what I should look for it's API. I found this utility class really handy that I think could help me achieve what I want

    ServiceUtil (VMware vSphere Web Services SDK Java samples Documentation)

    and here's a great example that does things I like (find Morefs in the tree of inventory by type) = > http://vlab-vwa.googlecode.com/svn/trunk/backend/apputils/vim25/VMUtils.java

    Here's something I tried not working

    /////////////////////////////////////////////////////////////////

    UserSessionService service;

    USession UserSession = service.getUserSession ();

    ServerInfo [] info = uSession.serversInfo;

    String sessionCookie = info [0] .sessionCookie;

    ServiceUtil util = new ServiceUtil();

    util.clientLoadSession (sessionCookie);

    REF ManagedObjectReference = util.getDecendentMoRef (null, "Cluster", "C - 2");

    /////////////////////////////////////////////////////////////////

    The thing I don't understand is how to create a 'authenticated' version of ServiceUtil which will help me to call the methods getDescendentMoref() and similar calls. I have a reference to a UserSessionService and VimObjectReferenceService (authenticated) and I was wondering if I can retrieve an instance of a ServiceUtil that I can use.

    Thank you

    Concerning

    See com.vmware.vise.usersession.UserSession, which has the property of serversInfo which is an array of ServerInfo.

  • Is there a way to get the list of hosts and its groups of belonging to the vCenter folder level in 5.5 web vsphere client plugin development?

    Hello

    I need to get the list of all hosts and its groups of belonging to the vcenter folder level.

    1. I created a view giving the extension point: vsphere.core.folder.monitorViews.

    2. After this step, I wrote the constraint as in my class of mediator,

    var ListConstraint:Constraint =

    QuerySpecUtil.createConstraintForRelationship ( _contextObject, 'childEntity');

    I was expecting a list of all child entities such as hosts, dc, cluster... But I have only the immediate child object which is only the Datacenter as my result.

    Is it possible to get all hosts and vCenter folder level Clusters because I need the entire list to vCenter (highest level).

    Other info:

    Object file has only two properties:

    1 childEntity - list of entities

    2 childType in-kind folder ('Virtual Machine', 'Data center'...)

    Is it possible to write a constraint specifying which list of childEntities I need using childType in.

    Example: Make Me childEntities that has a 'Host' and 'Cluster' childType but childType in doesn't have these two types.

    In addition, at this level, I could see the 'Associated objects' tab which has all the information I need, such as Clusters and Cluster tab hosts and host tab respectively.

    So, I think its possible to get this list to vCenter folder level.

    I have attached a screenshot representing the need. Kindly ignore the Conventions of naming in there since I edited the example comes with the sdk program.


    Query:

    1. How can I get the host and Cluster (table of relationship) list to vCenter folder level or even at the level of the vise.global.view?

    2. once I get this list, is it possible for me to manipulate that list and send the new list to IU?

    3. is there another way to do the same thing without the help of model classes and mediator?


    Pointers to this will be very useful.

    It is not possible to obtain all hosts a folder specific vCenter from a single query Data Manager.  You need to get the list of centers of data first and then get a list of data center hosts.

    It is best to make these repeated requests to the java level and return only the list that you want to the user interface.

    You can get all the objects in the host of the system with a simple query using a constraint with targetType = 'HostSystem', but you will need to eliminate those from other vCenter servers.  See how this chassis example queries all hosts the Java later in the getHosts() method: samples/chassis-app/chassisRackVSphere-service/src/main/java/com/vmware/samples/chassisRackVSphere/ChassisRackVSphereDataAdapter.java

    Another option is to use the vSphere Web Services SDK to browse vCenter. See the vSphere management forum for help on these APIs.  See this plugin of the sample using this SDK

    samples/vsphereviews/vsphere-wssdk-provider/src/main/java/com/vmware/samples/wssdkprovider/VmDataProviderImpl.java

Maybe you are looking for