Using Microsoft's winrm to access an xVM Server's public APIs over a secure JSR 262 ws-management connection

I just thought I'd respond to Jean-Francois's excellent blog articles on accessing JMX instrumentation through web-services and more especially, using JSR 262 Web Service Connector for JMX to accesss JMX instrumentation.

This shows how simple it is to access the xVM's upcoming public management APIs using a Windows client using winrm, Microsoft's ws-management client. It can connect to the xVM management stack using ws-management via a secured https connection with http basic authentication.

The upcoming xVM Server and xVM Ops Center management stacks that I've already discussed in earlier blog articles heavily leverage Java SE's JMX. Their public APIs are exposed as MXBeans available both using JMX remoting, and across ws-management.

We have deployed the early-access of the open source reference implementation of JSR 262 into our secured web-server in the xVM management stack, tied in with xVM's authorization and authentication system. This means that all the public APIs are not only available directly from Java clients using JMX-Remoting, but are also available using ws-management for other clients to use.

Here are a couple of simple examples of how to use Microsoft's winrm client to securely connect to an xVM Server using ws-management across https to query some of its data model, in this case, querying it about its  guests:

c:\\> REM Enumerate the ObjectNames of all the ServerMXBeans known on the <XVM_HOSTNAME>
c:\\> winrm enumerate http://jsr262.dev.java.net/DynamicMBeanResource?ObjectName=com.sun.xvm.domain:type=Server,\* \\
 -returnType:EPR -r:https://%XVM_HOSTNAME%/wsman/ea/jmxws \\
 -a:Basic -u:xvmadmin -skipCAcheck -skipCNcheck
c:\\> REM Read the value of cpu attribute (Composite Data) 
c:\\> REM for a given <SERVER_OBJECT_NAME> on the <XVM_HOSTNAME> machine
c:\\> winrm get http://jsr262.dev.java.net/DynamicMBeanResource?ObjectName=%SERVER_OBJECT_NAME% \\
 -fragment://:Property[@name="CpuInfos"] -r:https://%XVM_HOSTNAME%/wsman/ea/jmxws \\
 -a:Basic -u:xvmadmin -skipCAcheck -skipCNcheck

Note that this is pretty simple example, but you can do everything through this that you can do through xVM's browser interface, and that's one heck of a lot more! The xVM's SDK comes with javadoc for all of these public APIs, including the documented mappings to ws-man for each method call, thanks to the javadoc plugin developed as part of the JSR 262 reference implementation open-source project.



Comments:

Post a Comment:
Comments are closed for this entry.
About

nickstephen

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today