summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAnas Nashif <nashif@intel.com>2006-11-29 19:24:12 +0000
committerAnas Nashif <nashif@intel.com>2006-11-29 19:24:12 +0000
commit9c1493bf9e52e1e2201044f402066e795556e231 (patch)
tree5c214e066a30617e1f70b5a4b39665e5506950a5 /examples
parentd82e3db139e825f963561517f1ef9fe9e5b46d89 (diff)
use wsenum_enumerate_and_pull
set correct http codes in tests
Diffstat (limited to 'examples')
-rw-r--r--examples/win32_service.c59
1 files changed, 22 insertions, 37 deletions
diff --git a/examples/win32_service.c b/examples/win32_service.c
index a972feb..14d2932 100644
--- a/examples/win32_service.c
+++ b/examples/win32_service.c
@@ -153,6 +153,27 @@ static void print_info(CIM_Servie *service) {
printf("\tDescription: %s\n\n", service->Description );
}
+static int list_services(WsManClient *cl, WsXmlDocH doc, void *data)
+{
+
+ if (doc) {
+ WsXmlNodeH node = ws_xml_get_soap_body(doc);
+ node = ws_xml_get_child(node, 0, XML_NS_ENUMERATION, WSENUM_PULL_RESP);
+ node = ws_xml_get_child(node, 0, XML_NS_ENUMERATION, WSENUM_ITEMS);
+ if (ws_xml_get_child(node, 0, RESOURCE_URI , CLASSNAME )) {
+ CIM_Servie *service = ws_deserialize(wsman_client_get_context(cl),
+ node,
+ CIM_Servie_TypeInfo, CLASSNAME,
+ RESOURCE_URI, RESOURCE_URI,
+ 0, 0);
+ print_info(service);
+ }
+
+ }
+}
+
+
+
int main(int argc, char** argv)
{
@@ -216,44 +237,8 @@ int main(int argc, char** argv)
initialize_action_options(&options);
if (listall) {
- char *enumContext;
- WsXmlDocH enum_response;
-
- enum_response = wsenum_enumerate(cl, RESOURCE_URI, options);
- if (enum_response) {
- if (!wsman_get_client_response_code(cl) == 200 ||
- !wsman_get_client_response_code(cl) == 500) {
- return (1);
- }
- enumContext = wsenum_get_enum_context(enum_response);
- ws_xml_destroy_doc(enum_response);
- } else {
- return(1);
- }
-
- while (enumContext !=NULL) {
- doc = wsenum_pull(cl, RESOURCE_URI, enumContext, options);
+ wsenum_enumerate_and_pull(cl, RESOURCE_URI, options, list_services, NULL );
- if (wsman_get_client_response_code(cl) != 200 &&
- wsman_get_client_response_code(cl) != 500) {
- return (1);
- }
- enumContext = wsenum_get_enum_context(doc);
- if (doc) {
- WsXmlNodeH node = ws_xml_get_soap_body(doc);
- node = ws_xml_get_child(node, 0, XML_NS_ENUMERATION, WSENUM_PULL_RESP);
- node = ws_xml_get_child(node, 0, XML_NS_ENUMERATION, WSENUM_ITEMS);
- if (ws_xml_get_child(node, 0, RESOURCE_URI , CLASSNAME )) {
- CIM_Servie *service = ws_deserialize(wsman_client_get_context(cl),
- node,
- CIM_Servie_TypeInfo, CLASSNAME,
- RESOURCE_URI, RESOURCE_URI,
- 0, 0);
- print_info(service);
- }
- ws_xml_destroy_doc(doc);
- }
- }
} else if (start && argv[1]) {
//wsman_set_action_option(&options,FLAG_DUMP_REQUEST );
wsman_add_selectors_from_query_string(&options, u_strdup_printf("Name=%s", argv[1]));