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


C# XmlRpcSerializer.SerializeResponse方法代码示例

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


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

示例1: PaoloLiveraniProblem

 public void PaoloLiveraniProblem()
 {
     try
       {
     XmlRpcResponse resp = new XmlRpcResponse(new DataSet());
     Stream responseStream = new MemoryStream();
     XmlRpcSerializer serializer = new XmlRpcSerializer();
     serializer.SerializeResponse(responseStream, resp);
       }
       catch(XmlRpcInvalidReturnType ex)
       {
     string s = ex.Message;
       }
 }
开发者ID:ayende,项目名称:Subtext,代码行数:14,代码来源:serializeresponsetest.cs

示例2: Invoke

 public Stream Invoke(Stream requestStream)
 {
     try
       {
     XmlRpcSerializer serializer = new XmlRpcSerializer();
     Type type = this.GetType();
     XmlRpcServiceAttribute serviceAttr = (XmlRpcServiceAttribute)
       Attribute.GetCustomAttribute(this.GetType(),
       typeof(XmlRpcServiceAttribute));
     if (serviceAttr != null)
     {
       if (serviceAttr.XmlEncoding != null)
     serializer.XmlEncoding = Encoding.GetEncoding(serviceAttr.XmlEncoding);
       serializer.UseIntTag = serviceAttr.UseIntTag;
       serializer.UseStringTag = serviceAttr.UseStringTag;
       serializer.UseIndentation = serviceAttr.UseIndentation;
       serializer.Indentation = serviceAttr.Indentation;
     }
     XmlRpcRequest xmlRpcReq
       = serializer.DeserializeRequest(requestStream, this.GetType());
     XmlRpcResponse xmlRpcResp = Invoke(xmlRpcReq);
     Stream responseStream = new MemoryStream();
     serializer.SerializeResponse(responseStream, xmlRpcResp);
     responseStream.Seek(0, SeekOrigin.Begin);
     return responseStream;
       }
       catch (Exception ex)
       {
     XmlRpcFaultException fex;
     if (ex is XmlRpcException)
       fex = new XmlRpcFaultException(0, ((XmlRpcException)ex).Message);
     else if (ex is XmlRpcFaultException)
       fex = (XmlRpcFaultException)ex;
     else
       fex = new XmlRpcFaultException(0, ex.Message);
     XmlRpcSerializer serializer = new XmlRpcSerializer();
     Stream responseStream = new MemoryStream();
     serializer.SerializeFaultResponse(responseStream, fex);
     responseStream.Seek(0, SeekOrigin.Begin);
     return responseStream;
       }
 }
开发者ID:bricel,项目名称:DrutNet,代码行数:42,代码来源:XmlRpcServerProtocol.cs

示例3: SerializeResponse

    void SerializeResponse(
      IMessage responseMsg,
      ref ITransportHeaders responseHeaders, 
      ref Stream responseStream)
    {
      XmlRpcSerializer serializer = new XmlRpcSerializer();
      responseStream = new MemoryStream();
      responseHeaders = new TransportHeaders();

      ReturnMessage retMsg = (ReturnMessage)responseMsg;
      if (retMsg.Exception == null)
      {
        XmlRpcResponse xmlRpcResp = new XmlRpcResponse(retMsg.ReturnValue);
        serializer.SerializeResponse(responseStream, xmlRpcResp);
      }
      else if (retMsg.Exception is XmlRpcFaultException)
      {
        serializer.SerializeFaultResponse(responseStream, 
          (XmlRpcFaultException)retMsg.Exception);
      }
      else
      {
        serializer.SerializeFaultResponse(responseStream,
          new XmlRpcFaultException(1, retMsg.Exception.Message));
      }
      responseHeaders["Content-Type"] = "text/xml; charset=\"utf-8\"";
    }
开发者ID:RyanGrange,项目名称:Ketarin,代码行数:27,代码来源:XmlRpcServerFormatterSink.cs


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