add "ExcludeNilProperties" option to the client side

diff --git a/include/wsman-client-api.h b/include/wsman-client-api.h
index acfadcc..c8aa935 100644
--- a/include/wsman-client-api.h
+++ b/include/wsman-client-api.h
@@ -170,6 +170,7 @@
 #define FLAG_CIM_ASSOCIATORS                 0x4000
 #define FLAG_EVENT_SENDBOOKMARK		     0X8000
 #define FLAG_CIM_SCHEMA_OPT		    0X10000
+#define FLAG_EXCLUDE_NIL_PROPS		    0X20000
 
 	typedef struct {
 		unsigned long flags;
diff --git a/include/wsman-names.h b/include/wsman-names.h
index 3387d20..f663967 100644
--- a/include/wsman-names.h
+++ b/include/wsman-names.h
@@ -349,6 +349,10 @@
 #define WSMB_ACTION_FAULT     		"http://schemas.dmtf.org/wbem/wsman/1/cimbinding/fault"
 #define WSMB_SHOW_EXTENSION		"ShowExtensions"
 
+/* ows:ExcludeNilProperties
+   a per-request version of cim:omit_schema_optional in openwsman.conf
+ */
+#define WSMB_EXCLUDE_NIL_PROPS          "ExcludeNilProperties"
 
 // Catalog
 
diff --git a/src/lib/wsman-client.c b/src/lib/wsman-client.c
index 2f924a2..3ac5fb2 100644
--- a/src/lib/wsman-client.c
+++ b/src/lib/wsman-client.c
@@ -814,12 +814,22 @@
 	header = ws_xml_get_soap_header(request);
 	if (!body  || !header )
 		return NULL;
-	if (options && (options->flags & FLAG_CIM_EXTENSIONS) == FLAG_CIM_EXTENSIONS) {
+	/*
+	 * flags to be passed as <w:OptionSet ...> <w:Option Name="..." ...> > */
+	if (options && (options->flags & (FLAG_CIM_EXTENSIONS|FLAG_EXCLUDE_NIL_PROPS))) {
 		WsXmlNodeH opset = ws_xml_add_child(header,
 				XML_NS_WS_MAN, WSM_OPTION_SET, NULL);
-		WsXmlNodeH op = ws_xml_add_child(opset,
+		if ((options->flags & FLAG_CIM_EXTENSIONS) == FLAG_CIM_EXTENSIONS) {
+			WsXmlNodeH op = ws_xml_add_child(opset,
 				XML_NS_WS_MAN, WSM_OPTION, NULL);
-		ws_xml_add_node_attr(op, NULL, WSM_NAME, WSMB_SHOW_EXTENSION);
+			ws_xml_add_node_attr(op, NULL, WSM_NAME, WSMB_SHOW_EXTENSION);
+		}
+		if ((options->flags & FLAG_EXCLUDE_NIL_PROPS) == FLAG_EXCLUDE_NIL_PROPS) {
+			/* ExcludeNilProperties is non-standard, so put it under an openwsman namespace */
+			WsXmlNodeH op = ws_xml_add_child(opset,
+				XML_NS_OPENWSMAN, WSM_OPTION, NULL);
+			ws_xml_add_node_attr(op, NULL, WSM_NAME, WSMB_EXCLUDE_NIL_PROPS);
+		}
 	}