Ejemplo n.º 1
0
        public override void WriteObject(XmlWriter writer, object graph)
        {
            keepAlive keepAliveField = ((keepAlive)(graph));

            if (WriteParentElement(writer, true, true, graph))
            {
                if (WriteChildElement(writer, "myMacAddress", true, false, keepAliveField.myMacAddress))
                {
                    writer.WriteString(keepAliveField.myMacAddress);
                    writer.WriteEndElement();
                }
                if (WriteChildElement(writer, "mycurrentTime", false, false, keepAliveField.mycurrentTime))
                {
                    writer.WriteString(XmlConvert.ToString(keepAliveField.mycurrentTime));
                    writer.WriteEndElement();
                }
                if (WriteChildElement(writer, "port", false, false, keepAliveField.port))
                {
                    writer.WriteString(XmlConvert.ToString(keepAliveField.port));
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
            }
            return;
        }
Ejemplo n.º 2
0
        public override object ReadObject(XmlReader reader)
        {
            keepAlive keepAliveField = null;

            if (IsParentStartElement(reader, false, true))
            {
                keepAliveField = new keepAlive();
                reader.Read();
                if (IsChildStartElement(reader, "myMacAddress", true, false))
                {
                    reader.Read();
                    keepAliveField.myMacAddress = reader.ReadString();
                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "mycurrentTime", false, false))
                {
                    reader.Read();
                    keepAliveField.mycurrentTime = XmlConvert.ToInt64(reader.ReadString());
                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "port", false, false))
                {
                    reader.Read();
                    keepAliveField.port = XmlConvert.ToInt32(reader.ReadString());
                    reader.ReadEndElement();
                }
                reader.ReadEndElement();
            }
            return(keepAliveField);
        }
Ejemplo n.º 3
0
        public virtual keepAliveResponse keepAlive(keepAlive req)
        {
            // Create request header
            String action;

            action = "http://tempuri.org/IService1/keepAlive";
            WsWsaHeader header;

            header = new WsWsaHeader(action, null, EndpointAddress, m_version.AnonymousUri, null, null);
            WsMessage request = new WsMessage(header, req, WsPrefix.None);

            // Create request serializer
            keepAliveDataContractSerializer reqDcs;

            reqDcs             = new keepAliveDataContractSerializer("keepAlive", "http://tempuri.org/");
            request.Serializer = reqDcs;
            request.Method     = "keepAlive";


            // Send service request
            m_requestChannel.Open();
            WsMessage response = m_requestChannel.Request(request);

            m_requestChannel.Close();

            // Process response
            keepAliveResponseDataContractSerializer respDcs;

            respDcs = new keepAliveResponseDataContractSerializer("keepAliveResponse", "http://tempuri.org/");
            keepAliveResponse resp;

            resp = ((keepAliveResponse)(respDcs.ReadObject(response.Reader)));
            response.Reader.Dispose();
            response.Reader = null;
            return(resp);
        }