98 lines
3.2 KiB
C++
98 lines
3.2 KiB
C++
//----------------------------------------------------------------------------
|
|
//
|
|
// Copyright (C) 2003 Intel Corporation
|
|
//
|
|
// File: OpenWsmanClient.h
|
|
//
|
|
// Contents: A wrapper class for openweman
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#ifndef __SOAP_WSMAN_CLIENT_H
|
|
#define __SOAP_WSMAN_CLIENT_H
|
|
|
|
#include "stdsoap2.h"
|
|
#include "WsmanClient.h"
|
|
|
|
namespace WsmanClientNamespace
|
|
{
|
|
class SoapWsmanClient : public WsmanClient
|
|
{
|
|
private:
|
|
struct soap *soap;
|
|
char* username;
|
|
char* password;
|
|
string endpoint;
|
|
|
|
// private functions
|
|
// creates a soap header
|
|
SOAP_ENV__Header* CreateSoapHeader(const string& resourceUri, const string& action, const NameValuePairs* selectors = NULL) const;
|
|
|
|
// deallocates a soap header
|
|
void DeleteSoapHeader(SOAP_ENV__Header* header) const;
|
|
|
|
// pulls the items of an enumeration context
|
|
void PullItems(const string &resourceUri, const string& enumerationContext, vector<string>& items, const NameValuePairs *s = NULL) const;
|
|
|
|
// checks for errors
|
|
bool CheckWsmanResponse(int soapRet, soap_dom_element& response, const string& action) const;
|
|
|
|
// check the enumeration response
|
|
bool ResourceNotFound(soap_dom_element& enumerationRes) const;
|
|
|
|
// Copy constructor is declared private
|
|
SoapWsmanClient(const SoapWsmanClient& cl);
|
|
|
|
// operator = is declared private
|
|
SoapWsmanClient& operator =(const SoapWsmanClient& cl);
|
|
public:
|
|
|
|
// Construct from params.
|
|
SoapWsmanClient(const char* endpoint,
|
|
const char* user_name = NULL,
|
|
const char* password = NULL,
|
|
struct soap* inSoap = NULL);
|
|
|
|
// Destructor.
|
|
virtual ~SoapWsmanClient();
|
|
|
|
// Identify.
|
|
virtual string Identify() const {throw exception("Function Not Supported");}
|
|
|
|
/// Creates a new instance of a resource.
|
|
string Create(const string &resourceUri, const string &data) const;
|
|
|
|
/// Delete a resource.
|
|
void Delete(const string &resourceUri, const NameValuePairs *s = NULL) const;
|
|
|
|
/// Enumerate resource.
|
|
void Enumerate(const string &resourceUri, vector<string> &enumRes, const NameValuePairs *s = NULL) const;
|
|
|
|
/// Retrieve a resource.
|
|
string Get(const string &resourceUri, const NameValuePairs *s = NULL) const;
|
|
|
|
/// Update a resource.
|
|
string Put(const string &resourceUri, const string &content, const NameValuePairs *s = NULL) const;
|
|
|
|
/// Invokes a method and returns the results of the method call.
|
|
string Invoke(const string &resourceUri, const string &methodName, const string &content, const NameValuePairs *s = NULL) const;
|
|
|
|
// Submit a subscription
|
|
string Subscribe(const string &resourceUri, const SubscribeInfo &info, string &identifier) const;
|
|
|
|
// Renew a subscription
|
|
string Renew(const string &identifier, float expire) const;
|
|
|
|
// Terminate a subscription
|
|
void Unsubscribe(const string &identifier) const;
|
|
|
|
// Renew a subscription
|
|
virtual string Renew(const string &resourceUri, const string &identifier, float expire, const NameValuePairs *s = NULL) const {throw exception("Function Not Supported");}
|
|
|
|
// Terminate a subscription
|
|
virtual void Unsubscribe(const string &resourceUri, const string &identifier, const NameValuePairs *s = NULL) const {throw exception("Function Not Supported");}
|
|
|
|
};
|
|
} // namespace WsmanClient
|
|
#endif
|