当前位置: 首页>>代码示例>>C#>>正文


C# XmlRpcSerializer.DeserializeResponse方法代码示例

本文整理汇总了C#中CookComputing.XmlRpc.XmlRpcSerializer.DeserializeResponse方法的典型用法代码示例。如果您正苦于以下问题:C# XmlRpcSerializer.DeserializeResponse方法的具体用法?C# XmlRpcSerializer.DeserializeResponse怎么用?C# XmlRpcSerializer.DeserializeResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CookComputing.XmlRpc.XmlRpcSerializer的用法示例。


在下文中一共展示了XmlRpcSerializer.DeserializeResponse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AdvogatoProblem

 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)
       {
       }
 }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:32,代码来源:Copy+of+deserializeresponsetest.cs

示例2: AllowInvalidHTTPContentLeadingWhiteSpace

        public void AllowInvalidHTTPContentLeadingWhiteSpace()
        {
            string xml = @"

            <?xml version=""1.0"" ?>
            <methodResponse>
              <params>
            <param>
              <value><i4>12345</i4></value>
            </param>
              </params>
            </methodResponse>";
              Stream stm = new MemoryStream();
              StreamWriter wrtr = new StreamWriter(stm, Encoding.ASCII);
              wrtr.Write(xml);
              wrtr.Flush();
              stm.Position = 0;
              XmlRpcSerializer serializer = new XmlRpcSerializer();
              serializer.NonStandard = XmlRpcNonStandard.AllowInvalidHTTPContent;
              XmlRpcResponse response = serializer.DeserializeResponse(stm, typeof(int));

              Object o = response.retVal;
              Assert.IsTrue(o != null, "retval not null");
              Assert.IsTrue(o is int, "retval is int");
              Assert.AreEqual((int)o, 12345, "retval is 12345");
        }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:26,代码来源:Copy+of+deserializeresponsetest.cs

示例3: IntegerNullType

    public void IntegerNullType()
    {
      string xml = @"<?xml version=""1.0"" ?> 
<methodResponse>
  <params>
    <param>
      <value><int>12345</int></value>
    </param>
  </params>
</methodResponse>";
      StringReader sr = new StringReader(xml);
      XmlRpcSerializer serializer = new XmlRpcSerializer();
      XmlRpcResponse response = serializer.DeserializeResponse(sr, null);

      Object o = response.retVal;
      Assert.IsTrue(o != null, "retval not null");
      Assert.IsTrue(o is int, "retval is int");
      Assert.AreEqual((int)o, 12345, "retval is 12345");
    }
开发者ID:sgh1986915,项目名称:vfos-scraper-c-,代码行数:19,代码来源:deserializeresponsetest.cs

示例4: VoidReturnType

 public void VoidReturnType()
 {
     string xml = @"<?xml version=""1.0"" ?>
     <methodResponse>
       <params>
     <param>
       <value></value>
     </param>
       </params>
     </methodResponse>";
       StringReader sr = new StringReader(xml);
       XmlRpcSerializer serializer = new XmlRpcSerializer();
       XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(void));
       Assert.IsTrue(response.retVal == null, "retval is null");
 }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:15,代码来源:Copy+of+deserializeresponsetest.cs

示例5: InvalidXML

 public void InvalidXML()
 {
     string xml = @"response>";
       Stream stm = new MemoryStream();
       StreamWriter wrtr = new StreamWriter(stm, Encoding.ASCII);
       wrtr.Write(xml);
       wrtr.Flush();
       stm.Position = 0;
       XmlRpcSerializer serializer = new XmlRpcSerializer();
       XmlRpcResponse response = serializer.DeserializeResponse(stm, typeof(int));
 }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:11,代码来源:Copy+of+deserializeresponsetest.cs

示例6: String1IncorrectType

 public void String1IncorrectType()
 {
     try
       {
     string xml = @"<?xml version=""1.0"" ?>
     <methodResponse>
       <params>
     <param>
       <value>test string</value>
     </param>
       </params>
     </methodResponse>";
     StringReader sr = new StringReader(xml);
     XmlRpcSerializer serializer = new XmlRpcSerializer();
     XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(int));
     Assert.Fail("Should throw XmlRpcTypeMismatchException");
       }
       catch(XmlRpcTypeMismatchException)
       {
       }
 }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:21,代码来源:Copy+of+deserializeresponsetest.cs

示例7: DeserializeMessage

 IMessage DeserializeMessage(
   IMethodCallMessage mcm,
   ITransportHeaders headers,
   Stream stream)
 {
   XmlRpcSerializer serializer = new XmlRpcSerializer();
   object tp = mcm.MethodBase;           
   System.Reflection.MethodInfo mi = (System.Reflection.MethodInfo)tp;
   System.Type t = mi.ReturnType;
   XmlRpcResponse xmlRpcResp = serializer.DeserializeResponse(stream, t);
   IMessage imsg = new ReturnMessage(xmlRpcResp.retVal, null, 0, null, mcm);
   return imsg;
 } 
开发者ID:RyanGrange,项目名称:Ketarin,代码行数:13,代码来源:XmlRpcClientFormatterSink.cs

示例8: MissingStructMember

 public void MissingStructMember()
 {
     string xml = @"<?xml version='1.0'?>
     <methodResponse>
       <params>
     <param>
       <value>
     <struct>
       <member>
     <name>x</name>
     <value>
       <i4>123</i4>
     </value>
       </member>
     </struct>
       </value>
     </param>
       </params>
     </methodResponse>";
       StringReader sr = new StringReader(xml);
       XmlRpcSerializer serializer = new XmlRpcSerializer();
       try
       {
     XmlRpcResponse response
       = serializer.DeserializeResponse(sr, typeof(BillStruct));
     Assert.Fail("Should detect missing struct member");
       }
       catch(AssertionException)
       {
     throw;
       }
       catch(Exception)
       {
       }
 }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:35,代码来源:Copy+of+deserializeresponsetest.cs

示例9: ReturnNestedStruct

        public void ReturnNestedStruct()
        {
            string xml = @"<?xml version=""1.0"" encoding=""ISO-8859-1""?>
            <methodResponse>
              <params>
            <param>
              <value>
            <struct>
              <member>
            <name>version</name>
            <value><string>1.6</string></value>
              </member>
              <member>
            <name>record</name>
            <value>
              <struct>
                <member>
                  <name>firstName</name>
                  <value>Joe</value></member>
                <member>
                  <name>lastName</name>
                  <value>Test</value>
                </member>
              </struct>
            </value>
              </member>
            </struct>
              </value>
            </param>
              </params>
            </methodResponse>";

              StringReader sr = new StringReader(xml);
              XmlRpcSerializer serializer = new XmlRpcSerializer();
              XmlRpcResponse response
            = serializer.DeserializeResponse(sr, typeof(MyStruct));

              Object o = response.retVal;
              Assert.IsTrue(o is MyStruct, "retval is MyStruct");
              MyStruct mystr = (MyStruct)o;
              Assert.AreEqual(mystr.version, "1.6", "version is 1.6");
              Assert.IsTrue(mystr.record.firstName == "Joe", "firstname is Joe");
              Assert.IsTrue(mystr.record.lastName == "Test", "lastname is Test");
        }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:44,代码来源:Copy+of+deserializeresponsetest.cs

示例10: Donhrobjartz_XmlRpcStructNonMemberStructChild

 public void Donhrobjartz_XmlRpcStructNonMemberStructChild()
 {
     string xml = @"<?xml version=""1.0"" encoding=""iso-8859-1""?>
     <methodResponse>
     <params>
     <param>
     <value>
     <struct>
     <foo>
     This should be ignored.
     </foo>
     <member>
     <name>period</name>
     <value><string>1w</string></value>
     </member>
     <bar>
     This should be ignored.
     </bar>
     </struct>
     </value>
     </param>
     </params>
     </methodResponse>";
       StringReader sr1 = new StringReader(xml);
       XmlRpcSerializer serializer = new XmlRpcSerializer();
       serializer.NonStandard = XmlRpcNonStandard.IgnoreDuplicateMembers;
       XmlRpcResponse response = serializer.DeserializeResponse(sr1,
     typeof(XmlRpcStruct));
       XmlRpcStruct ret = (XmlRpcStruct)response.retVal;
       Assert.AreEqual(ret.Count,1);
 }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:31,代码来源:Copy+of+deserializeresponsetest.cs

示例11: MinDateTime4NotStrict

        public void MinDateTime4NotStrict()
        {
            string xml = @"<?xml version=""1.0"" ?>
            <methodResponse>
              <params>
            <param>
              <value><dateTime.iso8601>0000-00-00T00:00:00Z</dateTime.iso8601></value>
            </param>
              </params>
            </methodResponse>";
              StringReader sr = new StringReader(xml);
              XmlRpcSerializer serializer = new XmlRpcSerializer();
              serializer.NonStandard = XmlRpcNonStandard.MapZerosDateTimeToMinValue;
              XmlRpcResponse response = serializer.DeserializeResponse(sr, typeof(DateTime));

              Object o = response.retVal;
              Assert.IsTrue(o is DateTime, "retval is string");
              Assert.AreEqual((DateTime)o, DateTime.MinValue, "DateTime.MinValue");
        }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:19,代码来源:Copy+of+deserializeresponsetest.cs

示例12: ArrayInStruct

        public void ArrayInStruct()
        {
            // reproduce problem reported by Alexander Agustsson
              string xml = @"<?xml version=""1.0"" encoding=""ISO-8859-1""?>
            <methodResponse>
              <params>
            <param>
              <value>
            <struct>
              <member>
            <name>key3</name>
            <value>
              <array>
                <data>
                  <value>New Milk</value>
                  <value>Old Milk</value>
                </data>
              </array>
            </value>
              </member>
            </struct>
              </value>
            </param>
              </params>
            </methodResponse>";

              StringReader sr = new StringReader(xml);
              XmlRpcSerializer serializer = new XmlRpcSerializer();
              XmlRpcResponse response = serializer.DeserializeResponse(sr, null);

              Object o = response.retVal;
              Assert.IsTrue(o is XmlRpcStruct, "retval is XmlRpcStruct");
              XmlRpcStruct xrs = (XmlRpcStruct)o;
              Assert.IsTrue(xrs.Count == 1, "retval contains one entry");
              object elem = xrs["key3"];
              Assert.IsTrue(elem != null, "element has correct key");
              Assert.IsTrue(elem is Array, "element is an array");
              object[] array = (object[])elem;
              Assert.IsTrue(array.Length == 2, "array has 2 members");
              Assert.IsTrue(array[0] is string && (string)array[0] == "New Milk"
            && array[1] is string && (string)array[1] == "Old Milk",
            "values of array members");
        }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:43,代码来源:Copy+of+deserializeresponsetest.cs

示例13: Donhrobjartz_XmlRpcStructMemberDupValue

 public void Donhrobjartz_XmlRpcStructMemberDupValue()
 {
     string xml = @"<?xml version=""1.0"" encoding=""iso-8859-1""?>
     <methodResponse>
     <params>
     <param>
     <value>
     <struct>
     <member>
     <name>period</name>
     <value><string>1w</string></value>
     <value><string>284</string></value>
     </member>
     </struct>
     </value>
     </param>
     </params>
     </methodResponse>";
       StringReader sr1 = new StringReader(xml);
       XmlRpcSerializer serializer = new XmlRpcSerializer();
       serializer.NonStandard = XmlRpcNonStandard.IgnoreDuplicateMembers;
       XmlRpcResponse response = serializer.DeserializeResponse(sr1,
     typeof(XmlRpcStruct));
       XmlRpcStruct ret = (XmlRpcStruct)response.retVal;
 }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:25,代码来源:Copy+of+deserializeresponsetest.cs

示例14: BillKeenanProblem

        public void BillKeenanProblem()
        {
            string xml = @"<?xml version='1.0'?>
            <methodResponse>
              <params>
            <param>
              <value>
            <struct>
              <member>
            <name>x</name>
            <value>
              <i4>123</i4>
            </value>
              </member>
              <member>
            <name>s</name>
            <value>
              <string>ABD~~DEF</string>
            </value>
              </member>
              <member>
            <name>unexpected</name>
            <value>
              <string>this is unexpected</string>
            </value>
              </member>
            </struct>
              </value>
            </param>
              </params>
            </methodResponse>";
              StringReader sr = new StringReader(xml);
              XmlRpcSerializer serializer = new XmlRpcSerializer();
              XmlRpcResponse response
            = serializer.DeserializeResponse(sr, typeof(BillStruct));

              Object o = response.retVal;
              Assert.IsTrue(o is BillStruct, "retval is BillStruct");
              BillStruct bs = (BillStruct)o;
              Assert.IsTrue(bs.x == 123 && bs.s == "ABD~~DEF", "struct members");
        }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:41,代码来源:Copy+of+deserializeresponsetest.cs

示例15: Yolanda

        public void Yolanda()
        {
            string xml = @"<?xml version=""1.0"" encoding=""ISO-8859-1""?><methodResponse><params><param><value><array><data><value>addressbook</value><value>system</value></data></array></value></param></params></methodResponse>";
              StringReader sr = new StringReader(xml);
              XmlRpcSerializer serializer = new XmlRpcSerializer();
              XmlRpcResponse response = serializer.DeserializeResponse(sr, null);

              Object o = response.retVal;
        }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:9,代码来源:Copy+of+deserializeresponsetest.cs


注:本文中的CookComputing.XmlRpc.XmlRpcSerializer.DeserializeResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。