类别:程序开发

日期:2022-01-14 浏览:1785 评论:0

Web Service是一个平台独立的,低耦合的,自包含的、基于可编程的web的应用程序,可使用开放的XML(标准通用标记语言下的一个子集)标准来描述、发布、发现、协调和配置这些应用程序,用于开发分布式的交互操作的应用程序。
[WebMethod]
public  void HelloXml()
{
     string class1 = ReturnXml("1", "2", "3", "4", "5");

     Context.Response.ContentEncoding = System.Text.Encoding.UTF8;
     Context.Response.ContentType = "text/xml";
     Context.Response.Write(class1.ToString());
     Context.Response.Flush();
     Context.Response.End();

}


[WebMethod]
public XmlDocument HelloXml2()
{
     string class1 = ReturnXml("1", "2", "3", "4", "5");
     XmlDocument XmlDoc = new XmlDocument();
     XmlDoc.LoadXml(class1);
     return XmlDoc;

}



/// <summary>
/// 返回NCXML
/// </summary>
/// <param name="orgcode">组织编码</param>
/// <param name="u8no">凭证号</param>
/// <param name="UTNresultdescription">原因</param>
/// <param name="resulttype">加锁解锁类型</param>
/// <returns></returns>
public string ReturnXml(string orgcode, string u8no, string UTNresultdescription, string resulttype, string resultcode)
{
     string XmlFile = string.Empty;

     XmlFile = @"<?xml version='1.0' encoding='utf-8'?>
     <ufinterface billtype='' filename='' isexchange='' replace='' roottag='' sender='' successful=''>
     <sendresult>                                                         
     <orgcode>" + orgcode + "</orgcode><u8no>" + u8no + "</u8no><resultcode>" + resultcode + "</resultcode><UTNresultdescription>" + UTNresultdescription + "</UTNresultdescription>";
     XmlFile += "         <resulttype>" + resulttype + "</resulttype></sendresult></ufinterface>";

     return XmlFile;
}


本文标题:C# WebService 生成xml文档格式
本文链接:https://vtzw.com/post/846.html
作者授权:除特别说明外,本文由 零一 原创编译并授权 零一的世界 刊载发布。
版权声明:本文不使用任何协议授权,您可以任何形式自由转载或使用。
 您阅读本篇文章共花了: 

 可能感兴趣的文章

评论区

发表评论 / 取消回复

必填

选填

选填

◎欢迎讨论,请在这里发表您的看法及观点。