summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/create_resource.c3
-rw-r--r--src/wsman-client-options.c17
-rw-r--r--src/wsman-client-options.h3
-rw-r--r--src/wsman.c35
-rw-r--r--tests/interop/interop.c2
5 files changed, 38 insertions, 22 deletions
diff --git a/examples/create_resource.c b/examples/create_resource.c
index 905b8e2..a66a5fa 100644
--- a/examples/create_resource.c
+++ b/examples/create_resource.c
@@ -158,9 +158,10 @@ int main(int argc, char** argv)
array[3] = 5;
d->Handles.count = count;
d->Handles.data = array;
-
+/*
doc = ws_transfer_create(cl, RESOURCE_URI, d,
EXL_ExamplePolicy_TypeInfo, options);
+ */
ws_xml_dump_node_tree(stdout, ws_xml_get_doc_root(doc));
if (uri) {
diff --git a/src/wsman-client-options.c b/src/wsman-client-options.c
index f8ea0ca..4b50e2d 100644
--- a/src/wsman-client-options.c
+++ b/src/wsman-client-options.c
@@ -92,7 +92,7 @@ static char *cim_namespace = NULL;
static char *fragment = NULL;
static char *wsm_filter = NULL;
static char *wsm_dialect = NULL;
-static char *selectors = NULL;
+static char *input = NULL;
static unsigned long operation_timeout = 0;
static unsigned long max_envelope_size = 0;
@@ -135,6 +135,8 @@ char wsman_parse_options(int argc, char **argv)
"User name", "<username>" },
{ "path", 'g', U_OPTION_ARG_STRING, &url_path,
"Path", "<path>" },
+ { "input", 'J', U_OPTION_ARG_STRING, &input,
+ "File with resource for Create and Put operations in XML, can be a SOAP envelope", "<filename>" },
{ "password", 'p', U_OPTION_ARG_STRING, &password,
"Password", "<password>" },
{ "hostname", 'h', U_OPTION_ARG_STRING, &server,
@@ -174,8 +176,6 @@ char wsman_parse_options(int argc, char **argv)
"maximal envelope size" , "<size>" },
{ "fragment", 'F', U_OPTION_ARG_STRING, &fragment,
"Fragment (Supported Dialects: XPATH)" , "<fragment>" },
- { "selectors", 's', U_OPTION_ARG_STRING, &selectors,
- "Selectors for fetching", "<name1=val1&name2=val2...>"},
{ NULL }
};
@@ -431,6 +431,12 @@ char * wsman_options_get_test_file (void)
{
return test_case;
}
+
+char * wsman_options_get_input_file (void)
+{
+ return input;
+}
+
char * wsman_options_get_enum_mode (void)
{
return enum_mode;
@@ -453,10 +459,7 @@ char * wsman_options_get_filter (void)
{
return wsm_filter;
}
-char * wsman_options_get_selectors(void)
-{
- return selectors;
-}
+
char * wsman_options_get_dialect (void)
{
return wsm_dialect;
diff --git a/src/wsman-client-options.h b/src/wsman-client-options.h
index 130b9dd..8f9374d 100644
--- a/src/wsman-client-options.h
+++ b/src/wsman-client-options.h
@@ -24,6 +24,7 @@ extern char *wsman_options_get_cafile(void);
extern int wsman_options_get_max_elements(void);
extern char * wsman_options_get_test_file(void);
+extern char * wsman_options_get_input_file(void);
extern int wsman_options_get_action(void);
extern char *wsman_options_get_resource_uri(void);
extern hash_t *wsman_options_get_properties (void);
@@ -37,7 +38,7 @@ extern char wsman_options_get_step_request (void);
extern char wsman_options_get_estimate_enum (void);
extern char * wsman_options_get_fragment (void);
extern char * wsman_options_get_filter (void);
-extern char * wsman_options_get_selectors (void);
+
extern char * wsman_options_get_dialect (void);
extern const char * wsman_options_get_config_file (void);
extern unsigned long wsman_options_get_max_envelope_size (void);
diff --git a/src/wsman.c b/src/wsman.c
index 840cd85..1b9cd1a 100644
--- a/src/wsman.c
+++ b/src/wsman.c
@@ -113,7 +113,7 @@ main(int argc, char **argv)
WsXmlDocH rqstDoc;
actionOptions options;
WsXmlDocH enum_response;
-
+ WsXmlDocH resource;
char *enumeration_mode, *binding_enumeration_mode, *resource_uri_with_selectors;
char *resource_uri = NULL;
@@ -155,8 +155,8 @@ main(int argc, char **argv)
exit(EXIT_FAILURE);
}
/*
- * Setup Resource URI and Selectors
- */
+ * Setup Resource URI and Selectors
+ */
resource_uri_with_selectors = wsman_options_get_resource_uri();
if (resource_uri_with_selectors) {
wsman_set_options_from_uri(resource_uri_with_selectors, &options);
@@ -182,10 +182,6 @@ main(int argc, char **argv)
if (wsman_options_get_dialect()) {
options.dialect = wsman_options_get_dialect();
}
- if (wsman_options_get_selectors()) {
- wsman_add_selectors_from_query_string(&options,
- wsman_options_get_selectors());
- }
options.properties = wsman_options_get_properties();
options.cim_ns = wsman_options_get_cim_namespace();
@@ -225,14 +221,29 @@ main(int argc, char **argv)
}
break;
case WSMAN_ACTION_TRANSFER_CREATE:
- doc = ws_transfer_create(cl, resource_uri, NULL, NULL, options);
- if (doc) {
- wsman_output(doc);
- ws_xml_destroy_doc(doc);
+ if (wsman_options_get_input_file()) {
+ resource = wsman_client_read_file(cl,
+ wsman_options_get_input_file(), "UTF-8", 0);
+ doc = ws_transfer_create(cl, resource_uri, resource, options);
+ ws_xml_destroy_doc(resource);
+ if (doc) {
+ wsman_output(doc);
+ ws_xml_destroy_doc(doc);
+ }
+ } else {
+ fprintf(stderr, "Missing resource data\n");
}
break;
case WSMAN_ACTION_TRANSFER_PUT:
- doc = ws_transfer_put1(cl, resource_uri, options);
+ if (wsman_options_get_input_file()) {
+ printf("input file provided\n");
+ resource = wsman_client_read_file(cl,
+ wsman_options_get_input_file(), "UTF-8", 0);
+ doc = ws_transfer_put(cl, resource_uri, resource, options);
+ ws_xml_destroy_doc(resource);
+ } else {
+ doc = ws_transfer_get_and_put(cl, resource_uri, options);
+ }
if (doc) {
wsman_output(doc);
ws_xml_destroy_doc(doc);
diff --git a/tests/interop/interop.c b/tests/interop/interop.c
index fdc66c0..145cc22 100644
--- a/tests/interop/interop.c
+++ b/tests/interop/interop.c
@@ -184,7 +184,7 @@ static int run_interop_test (WsManClient *cl, WsXmlNodeH scenario, InteropTest i
wsman_add_selectors_list_from_node(input, &options);
set_props(&options, ws_xml_get_node_text(k), ws_xml_get_node_text(v) );
- response = ws_transfer_put1(cl, resource_uri, options);
+ response = ws_transfer_get_and_put(cl, resource_uri, options);
xml_parser_doc_dump(stdout, response);
}