From 91ebf09155455aa34a9469ece68d83c7cb2c2d0f Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 2 Aug 2007 21:48:14 +0000 Subject: fixed cpp client removed obsolete client --- examples/Makefile.am | 2 +- examples/cpp/EnumInstance.cpp | 27 ++++++++++++++++++--------- examples/cpp/GetInstance.cpp | 16 ---------------- examples/cpp/Makefile.am | 5 +---- 4 files changed, 20 insertions(+), 30 deletions(-) delete mode 100644 examples/cpp/GetInstance.cpp (limited to 'examples') diff --git a/examples/Makefile.am b/examples/Makefile.am index 766fcd2..fa0aa4d 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = #cpp +SUBDIRS = cpp AM_CFLAGS = @CFLAGS@ diff --git a/examples/cpp/EnumInstance.cpp b/examples/cpp/EnumInstance.cpp index 2a5cc53..223ee75 100644 --- a/examples/cpp/EnumInstance.cpp +++ b/examples/cpp/EnumInstance.cpp @@ -1,5 +1,6 @@ #include -#include +#include +#include using std::cout; @@ -7,6 +8,7 @@ using namespace WsmanClientNamespace; int main(int argc, char* argv[]) { const char *endpoint, *resource_uri; + u_uri_t *uri; if (argc< 3) { fprintf(stderr, "Usage: %s \n", argv[0]); } @@ -17,18 +19,25 @@ int main(int argc, char* argv[]) fprintf(stderr, "endpoint option required\n"); return 1; } - WsmanClient client = WsmanClient(endpoint); + if (endpoint != NULL) + if (u_uri_parse((const char *) endpoint, &uri) != 0 ) + return 1; + OpenWsmanClient *client = new OpenWsmanClient( uri->host, + uri->port, + uri->path, + uri->scheme, + "digest", + uri->user, + uri->pwd); vector vec; try { - client.Enumerate(resource_uri, vec ); + client->Enumerate(resource_uri, vec ); } - catch (WsmanException &e) { - cout << "Fault:\n"; - cout << "\tCode:\t\t" << e.GetFaultCode() << "\n"; - cout << "\tSubCode:\t" << e.GetFaultSubcode() << "\n"; - cout << "\tDetail:\t\t" << e.GetFaultDetail() << "\n"; - cout << "\tReson:\t\t" << e.GetFaultReason() << "\n"; + catch (GeneralWsmanException &e) { + printf("\nError: failed while calling AMT_SOAPEventSubscriber::Delete routine\n"); + printf("GeneralWsmanException:\n"); + printf("%s\n", e.what()); } for (vector::iterator iter = vec.begin(); diff --git a/examples/cpp/GetInstance.cpp b/examples/cpp/GetInstance.cpp deleted file mode 100644 index 965fccc..0000000 --- a/examples/cpp/GetInstance.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -using std::cout; - -using namespace WsmanClientNamespace; -int main(int argc, char* argv[]) -{ - WsmanClient client = WsmanClient("http://wsman:secret@192.168.1.41:8889/wsman"); - NameValuePairs selectors = NameValuePairs(); - selectors["CreationClassName"] = "CWS_Instance"; - selectors["Id"] = "Instance #1"; - string r = client.Get("http:///cws.sblim.sf.net/wbem/wscim/1/cim-schema/2/CWS_Instance", &selectors ); - cout << "resource: \n" << r << "\n"; - return 0; -} diff --git a/examples/cpp/Makefile.am b/examples/cpp/Makefile.am index 10ad9f8..e1bbf74 100644 --- a/examples/cpp/Makefile.am +++ b/examples/cpp/Makefile.am @@ -6,12 +6,9 @@ CXXFLAGS = \ $(OPENWSMAN_CFLAGS) EnumInstance_SOURCES = \ EnumInstance.cpp -GetInstance_SOURCES = \ - GetInstance.cpp noinst_PROGRAMS = \ - EnumInstance \ - GetInstance + EnumInstance -- cgit