CookComputing.XmlRpc.XmlRpcSerializer.DeserializeResponse C# (CSharp) Method

DeserializeResponse() public method

public DeserializeResponse ( Stream stm, Type svcType ) : CookComputing.XmlRpc.XmlRpcResponse
stm Stream
svcType System.Type
return CookComputing.XmlRpc.XmlRpcResponse
        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);
        }

Same methods

XmlRpcSerializer::DeserializeResponse ( TextReader txtrdr, Type svcType ) : CookComputing.XmlRpc.XmlRpcResponse
XmlRpcSerializer::DeserializeResponse ( XmlDocument xdoc, Type returnType ) : CookComputing.XmlRpc.XmlRpcResponse

Usage Example

 public void AdvogatoProblem()
 {
     string xml = @"<?xml version='1.0'?>
     <methodResponse>
     <params>
     <param>
     <array>
     <data>
     <value>
     <dateTime.iso8601>20020707T11:25:37</dateTime.iso8601>
     </value>
     <value>
     <dateTime.iso8601>20020707T11:37:12</dateTime.iso8601>
     </value>
     </data>
     </array>
     </param>
     </params>
     </methodResponse>";
       StringReader sr = new StringReader(xml);
       XmlRpcSerializer serializer = new XmlRpcSerializer();
       try
       {
     XmlRpcResponse response
       = serializer.DeserializeResponse(sr, null);
     Object o = response.retVal;
     Assert.Fail("should have thrown XmlRpcInvalidXmlRpcException");
       }
       catch(XmlRpcInvalidXmlRpcException)
       {
       }
 }
All Usage Examples Of CookComputing.XmlRpc.XmlRpcSerializer::DeserializeResponse