summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnas Nashif <nashif@intel.com>2007-08-02 21:48:14 +0000
committerAnas Nashif <nashif@intel.com>2007-08-02 21:48:14 +0000
commit91ebf09155455aa34a9469ece68d83c7cb2c2d0f (patch)
tree6ff866d043bddf8389169125878f1f15e834beb2
parentf5427c38cd083759038724c4d0f5344d8fbd64d1 (diff)
downloadwsmancli-91ebf09155455aa34a9469ece68d83c7cb2c2d0f.tar.gz
wsmancli-91ebf09155455aa34a9469ece68d83c7cb2c2d0f.tar.xz
wsmancli-91ebf09155455aa34a9469ece68d83c7cb2c2d0f.zip
fixed cpp client
removed obsolete client
-rw-r--r--configure.in2
-rw-r--r--examples/Makefile.am2
-rw-r--r--examples/cpp/EnumInstance.cpp27
-rw-r--r--examples/cpp/GetInstance.cpp16
-rw-r--r--examples/cpp/Makefile.am5
-rw-r--r--src/wsman.c13
6 files changed, 28 insertions, 37 deletions
diff --git a/configure.in b/configure.in
index ffce54a..4ff99a3 100644
--- a/configure.in
+++ b/configure.in
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(wsmancli, 1.1.0)
+AC_INIT(wsmancli, 1.2.0)
AC_CONFIG_SRCDIR(wsmancli.spec.in)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(config.h)
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 <iostream>
-#include <cpp/WsmanClient.h>
+#include <cpp/OpenWsmanClient.h>
+#include <u/libu.h>
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 <endpoint> <resource uri>\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<string> 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<string>::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 <iostream>
-#include <cpp/WsmanClient.h>
-
-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
diff --git a/src/wsman.c b/src/wsman.c
index 6fff78f..02fba8c 100644
--- a/src/wsman.c
+++ b/src/wsman.c
@@ -298,7 +298,7 @@ char wsman_parse_options(int argc, char **argv)
}
u_error_free(error);
- // set default options
+ // set default options
if (server_port == 0) {
server_port = cainfo ? 8888 : 8889;
}
@@ -363,8 +363,8 @@ request_usr_pwd( WsManClient *client, wsman_auth_type_t auth,
wsmc_transport_get_auth_name( auth));
*/
printf("User name: ");
- fflush(stdout);
- if ( (p = fgets(user, 20, stdin) ) != NULL )
+ fflush(stdout);
+ if ( (p = fgets(user, 20, stdin) ) != NULL )
{
if (strchr(user, '\n'))
@@ -467,7 +467,7 @@ int main(int argc, char **argv)
cl = wsmc_create(server,
server_port,
url_path,
- cainfo? "https" : "http",
+ cainfo? "https" : "http",
username,
password);
}
@@ -711,8 +711,10 @@ int main(int argc, char **argv)
if (wsmc_get_response_code(cl) != 200
&& wsmc_get_response_code(cl) != 400
&& wsmc_get_response_code(cl) != 500) {
+ u_free(enumContext);
break;
}
+ u_free(enumContext);
enumContext = wsmc_get_enum_context(doc);
if (doc) {
ws_xml_destroy_doc(doc);
@@ -735,9 +737,8 @@ int main(int argc, char **argv)
}
}
wsmc_options_destroy(options);
- wsmc_release(cl);
-
wsmc_transport_fini();
+ wsmc_release(cl);
if (ini) {
iniparser_freedict(ini);
}