예제 #1
0
        public static void InvokeMethod(CimXmlWriter cxw, InvokeMethodOpSettings settings, CimName defaultNamespace)
        {
            #region Actual XML Request
            /*
             *      --- Static Method Call ---
             *
            <?xml version="1.0" encoding="utf-8" ?>
            <CIM CIMVERSION="2.0" DTDVERSION="2.0">
                <MESSAGE ID="1001" PROTOCOLVERSION="1.0">
                    <SIMPLEREQ>
                        <METHODCALL NAME="KillAll">
                            <LOCALCLASSPATH>
                                <LOCALNAMESPACEPATH>
                                    <NAMESPACE NAME="smash"/>
                                </LOCALNAMESPACEPATH>
                                <CLASSNAME NAME="OMC_UnixProcess"/>
                            </LOCALCLASSPATH>
                            <PARAMVALUE NAME="arg" PARAMTYPE="string">
                                <VALUE>watch</VALUE>
                            </PARAMVALUE>
                        </METHODCALL>
                    </SIMPLEREQ>
                </MESSAGE>
            </CIM>
            */

            /*
             *      --- Method Call ---
             *
            <?xml version="1.0" encoding="utf-8" ?>
            <CIM CIMVERSION="2.0" DTDVERSION="2.0">
                <MESSAGE ID="1001" PROTOCOLVERSION="1.0">
                    <SIMPLEREQ>
                        <METHODCALL NAME="SendSignal">
                            <LOCALINSTANCEPATH>
                                <LOCALNAMESPACEPATH>
                                    <NAMESPACE NAME="smash"/>
                                </LOCALNAMESPACEPATH>
                                <INSTANCENAME CLASSNAME="OMC_UnixProcess">
                                    <KEYBINDING NAME="Handle">
                                        <KEYVALUE VALUETYPE="string">10669</KEYVALUE>
                                    </KEYBINDING>
                                    <KEYBINDING NAME="OSCreationClassName">
                                        <KEYVALUE VALUETYPE="string">OMC_OperatingSystem</KEYVALUE>
                                    </KEYBINDING>
                                    <KEYBINDING NAME="OSName">
                                        <KEYVALUE VALUETYPE="string">Linux</KEYVALUE>
                                    </KEYBINDING>
                                    <KEYBINDING NAME="CSCreationClassName">
                                        <KEYVALUE VALUETYPE="string">OMC_UnitaryComputerSystem</KEYVALUE>
                                    </KEYBINDING>
                                    <KEYBINDING NAME="CSName">
                                        <KEYVALUE VALUETYPE="string">d1850.cim.lab.novell.com</KEYVALUE>
                                    </KEYBINDING>
                                    <KEYBINDING NAME="CreationClassName">
                                        <KEYVALUE VALUETYPE="string">OMC_UnixProcess</KEYVALUE>
                                    </KEYBINDING>
                                </INSTANCENAME>
                            </LOCALINSTANCEPATH>
                            <PARAMVALUE NAME="signal" PARAMTYPE="sint32">
                                <VALUE>9</VALUE>
                            </PARAMVALUE>
                        </METHODCALL>
                    </SIMPLEREQ>
                </MESSAGE>
            </CIM>
            */
            #endregion

            // Set the Method Name
            cxw.WriteMethodCallStartElement(settings.MethodName);

            // Write the LocalObjectPath
            if (settings.ObjectName is CimName)
            {
                cxw.WriteCimClassPath((CimName)settings.ObjectName, defaultNamespace);
            }
            else if (settings.ObjectName is CimInstanceName)
            {
                cxw.WriteCimInstancePath((CimInstanceName)settings.ObjectName, defaultNamespace);
            }
            else
            {
                throw new Exception("Not implemented yet");
            }

            // Write the parameter values
            cxw.WriteCimParameterValueList(settings.ParameterList);

            //// Set the OpSettings
            //cxw.WriteIncludeClassOrigin(settings.IncludeClassOrigin);
            //cxw.WriteClassNameParam(settings.ClassName);
            //cxw.WriteIncludeQualifiers(settings.IncludeQualifiers);
            //cxw.WriteLocalOnly(settings.LocalOnly);
            //cxw.WritePropertyList(settings.PropertyList);

            //</METHODCALL>
            cxw.WriteEndElement();
        }