コード例 #1
0
        public XmlRpcResponse DeserializeResponse(Stream stm, Type svcType)
        {
            if (stm == null)
            {
                throw new ArgumentNullException("stm",
                                                "XmlRpcSerializer.DeserializeResponse");
            }
            if (AllowInvalidHTTPContent)
            {
                Stream newStm = new MemoryStream();
                Util.CopyStream(stm, newStm);
                stm          = newStm;
                stm.Position = 0;
                while (true)
                {
                    // for now just strip off any leading CR-LF characters
                    int byt = stm.ReadByte();
                    if (byt == -1)
                    {
                        throw new XmlRpcIllFormedXmlException(
                                  "Response from server does not contain valid XML.");
                    }
                    if (byt != 0x0d && byt != 0x0a && byt != ' ' && byt != '\t')
                    {
                        stm.Position = stm.Position - 1;
                        break;
                    }
                }
            }
            XmlReader xmlRdr = XmlRpcXmlReader.Create(stm);

            return(DeserializeResponse(xmlRdr, svcType));
        }
コード例 #2
0
        public XmlRpcResponse DeserializeResponse(TextReader txtrdr, Type svcType)
        {
            if (txtrdr == null)
            {
                throw new ArgumentNullException("txtrdr",
                                                "XmlRpcSerializer.DeserializeResponse");
            }
            XmlReader xmlRdr = XmlRpcXmlReader.Create(txtrdr);

            return(DeserializeResponse(xmlRdr, svcType));
        }