Exemplo n.º 1
0
        public static int requestDERGroupMembers([MarshalAs(UnmanagedType.LPTStr)] String path,
                                                 [MarshalAs(UnmanagedType.LPTStr)] String mrid,
                                                 [MarshalAs(UnmanagedType.LPTStr)] ref String xml)
        {
            DERResult result = new DERResult();

            try
            {
                Console.WriteLine("DER file : " + path);
                Console.WriteLine("MRID : " + mrid);
                String   SOAPMessage  = null;
                String   SOAPResponse = null;
                String[] rvalue       = CIM.requestDERGroupMembers(path, mrid, ref SOAPMessage, ref SOAPResponse);

                result.Members      = rvalue;
                result.SOAPMessage  = SOAPMessage;
                result.SOAPResponse = SOAPResponse;
                result.Returncode   = 0;
            }
            catch (Exception e)
            {
                result.Returncode   = 1;
                result.ErrorMessage = e.ToString();
                Console.Write("Exception thrown by requestDERGroupMembers : ", e);
            }

            XmlSerializer ser    = new XmlSerializer(typeof(DERResult));
            StringWriter  writer = new StringWriter();

            ser.Serialize(writer, result);
            xml = writer.ToString();

            return(result.Returncode);
        }
Exemplo n.º 2
0
        /// <summary>
        /// convenience function, loads config and requests der member info
        /// </summary>
        /// <param name="path">file name</param>
        /// <param name="mrid">unique identifier for DER group</param>
        /// <returns></returns>
        public static String[] requestDERGroupMembers(String path, String mrid, ref String SOAPMessage, ref String SOAPResponse)
        {
            CIM c = new CIM();

            c._data = DERMSInterface.CIMData.read(path);

            String[] s = c.requestDERGroupMembers(mrid);
            if (s == null || s.Length < 1)
            {
                Console.WriteLine("DEBUG : soap call returned 0 records");
            }
            else
            {
                Console.WriteLine("DEBUG : soap call returned " + s.Length + " records");
                foreach (string a in s)
                {
                    Console.WriteLine("DEBUG : member = " + a);
                }
            }
            SOAPMessage  = c.LastMessageSent;
            SOAPResponse = c.LastMessageReceived;
            return(s);
        }