next up previous contents
Next: Choosing the Encoding Up: CIM Client API Previous: CIM Client API   Contents

Selecting a Protocol

The first step is to define the means of communication between the client and the CIMOM. Currently the only protocol supported is HTTP. An OW_CIMProtocolIFCRef must be created as this will be passed to the encoding mechanism. This can be done in the following manner:
OW_CIMProtocolIFCRef httpClient(new OW_HTTPClient(url));. The constructor of OW_HTTPClient takes a single argument: an OW_String that is the URL to the CIMOM.

A URL takes the form
[protocol://][username:password@]<hostname>[:port][path]. The protocol can be http, https, or ipc (Unix Domain Socket). If the protocol is not given, http is assumed. Username and password are optional. If not provided, and authentication is required, the username and password can be obtained through a callback which will be described shortly. The hostname is the name or IP address of the computer where the CIMOM is running. If the port is not given, 5988 is assumed if the protocol is http, and 5989 is assumed if the protocol is https. The path specifies the location of the CIM Server. This is normally /cimom. The OpenWBEM cimom ignores the path, but it may matter to some others.

At this point a callback can be provided to obtain a username and password if the CIM Server requests authentication. A callback for username and password is created by deriving from OW_ClientAuthCBIFC. Suppose the new derived class is called GetLoginInfo. The callback would be provided to the HTTP Client in the following manner:
OW_CIMClientAuthCBIFCRef getLoginInfo(new GetLoginInfo);
httpClient->setLoginCallBack(getLoginInfo);


next up previous contents
Next: Choosing the Encoding Up: CIM Client API Previous: CIM Client API   Contents
Bart Whiteley 2002-12-12