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;
}
}
}
XmlDocument xdoc = new XmlDocument();
try
{
xdoc.Load(stm);
}
catch (Exception ex)
{
throw new XmlRpcIllFormedXmlException(
"Response from server does not contain valid XML.", ex);
}
return DeserializeResponse(xdoc, svcType);
}