Module WsMan
In: rwsman_xmlattr.c
rwsman_xmldoc.c
rwsman_xmlnode.c
rwsmanc_identify.c
rwsman_client.c
rwsman_clientoption.c
rwsman.c

WsMan is the module namespace for all openwsman client bindings

The bindings itself can be devided in two major parts

  1. XML Operations (XmlAttr, XmlNode, XmlDoc)
  2. Client connection and options (Client, ClientOption)

Executing a WS-Man action comprises the following steps

  • Create a client connection with Client.new
  • Create an option instance with ClientOption.new and set option attributes as appropriate
  • Execute the command (one of create, get, …) resulting in an instance of the commands base class (Create, Get, …) which all have XmlDoc as the common ancestor.
  • Extract the relevant information from the resulting XML document resp. the result instance.

Some result classes (like Identify) are derived from XmlDoc and define specific accessor functions for well known xml nodes within the SOAP result. Most just return the raw SOAP based XML document and do not imply any structure.

Example:

    # set up client connection
    client = WsMan::Client.new( "http", "vista.windows.org", "80", "/wsman", "wsman", "secret" )
    # set up action options
    options = WsMan::ClientOption.new
    options.selector_add( "Name", "Themes" )
    # run 'invoke' action
    uri = "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Service"
    result = client.invoke( "uri", "StopService", options )
    puts "Error" result.body.child.name == "Fault"   # first child of SOAP body == "Fault" ?

Methods

debug   debug=  

Classes and Modules

Class WsMan::Client
Class WsMan::ClientOption
Class WsMan::Identify
Class WsMan::XmlAttr
Class WsMan::XmlDoc
Class WsMan::XmlNode

Constants

NS_SOAP = "http   //www.w3.org/2003/05/soap-envelope"
NS_WSMAN = "http   //schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
NS_NAMESPACES = "http   //www.w3.org/XML/1998/namespace"
NS_ADDRESSING = "http   //schemas.xmlsoap.org/ws/2004/08/addressing"
NS_DISCOVERY = "http   //schemas.xmlsoap.org/ws/2004/10/discovery"
NS_EVENTING = "http   //schemas.xmlsoap.org/ws/2004/08/eventing"
NS_ENUMERATION = "http   //schemas.xmlsoap.org/ws/2004/09/enumeration"
NS_TRANSFER = "http   //schemas.xmlsoap.org/ws/2004/09/transfer"
NS_SCHEMA = "http   //www.w3.org/2001/XMLSchema"
NS_SCHEMA_INSTANCE = "http   //www.w3.org/2001/XMLSchema-instance"
NS_WSMAN_ID = "http   //schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd"

Public Class methods

Return openwsman debug level.

[Source]

/*
 * call-seq:
 *   WsMan::debug
 *
 * Return openwsman debug level.
 */

static VALUE
rwsman_debug_get( VALUE module )
{
    debug_level_e d = wsman_debug_get_level();
    return INT2FIX( d );
}

Set openwsman debug level.

[Source]

/*
 * call-seq:
 *   WsMan::debug = 1
 *   WsMan::debug = 0
 *
 * Set openwsman debug level.
 */

static VALUE
rwsman_debug_set( VALUE module, VALUE dbg )
{
    static int init = 0;
    int d = FIX2INT( dbg );

    if (!init && d != 0) {
        init = 1;
        debug_add_handler( debug_message_handler, DEBUG_LEVEL_ALWAYS, NULL );
    }
    wsman_debug_set_level( d );

    return Qnil;
}

[Validate]