Openwsman client api - Openwsman/openwsman GitHub Wiki
The Openwsman 'C' API
Basics
There is Client to describe the connection to a WS-Man server, Actions you can run (like Get, Put, Enumerate, ...) and ClientOptions to pass action parameters.
Client
The type describing the Client is WsManClient
ClientOptions
The type describing ClientOption is client_opt_t
Actions
Actions are function calls operating on WsManClient
, client_opt_i
and a Resource URI (char *
)
All such functions start with wsmc_action_
.
If a wsmc_action_* function returns NULL, then the client connection failed (i.e. client not responding, authentication failure, etc.).
You can then use wsmc_get_fault_string()
, wsmc_get_last_error()
and wsmc_get_response_code()
to get more details about the client state.
wsmc_get_last_error()
gives you a CURL error code
while wsmc_get_response_code()
gives a HTTP status code(i.e. 401 for unauthorized).
If you get a non-NULL response from wsmc_action_*, then client connection could be established. Then you still need to wsmc_check_for_fault(WsXmlDocH response)
to check for server errors.