using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services.Description;
using System.Web.Services.Protocols;
using System.Web.Services.Discovery;
using System.Web.Services;
using System.Net;
using System.IO;
using System.CodeDom;
using System.CodeDom.Compiler;
using Microsoft.CSharp;
using System.Reflection;
using System.Text; namespace WebServerProjectDemo
{
/// <summary>
///
/// </summary>
public class WebServiceHelper
{
#region InvokeWebService
/// <summary>
///
/// </summary>
/// <param name="url"></param>
/// <param name="methodname"></param>
/// <param name="args"></param>
/// <returns></returns>
public static object InvokeWebService(string url, string methodname, object[] args)
{
return WebServiceHelper.InvokeWebService(url, null, methodname, args);
}
/// <summary>
/// 动态调用WebService
/// </summary>
/// <param name="url">WebService地址</param>
/// <param name="classname">类名</param>
/// <param name="methodname">方法名(模块名)</param>
/// <param name="args">参数列表</param>
/// <returns>object</returns>
public static object InvokeWebService(string url, string classname, string methodname, object[] args)
{
string @namespace = "ServiceBase.WebService.DynamicWebLoad";
if (classname == null || classname == "")
{
classname = WebServiceHelper.GetClassName(url);
}
//获取服务描述语言(WSDL)
WebClient wc = new WebClient();
Stream stream = wc.OpenRead(url + "?WSDL");
ServiceDescription sd = ServiceDescription.Read(stream);
ServiceDescriptionImporter sdi = new ServiceDescriptionImporter();
sdi.AddServiceDescription(sd, "", "");
CodeNamespace cn = new CodeNamespace(@namespace);
//生成客户端代理类代码
CodeCompileUnit ccu = new CodeCompileUnit();
ccu.Namespaces.Add(cn);
sdi.Import(cn, ccu);
CSharpCodeProvider csc = new CSharpCodeProvider();
ICodeCompiler icc = csc.CreateCompiler();
//设定编译器的参数
CompilerParameters cplist = new CompilerParameters();
cplist.GenerateExecutable = false;
cplist.GenerateInMemory = true;
cplist.ReferencedAssemblies.Add("System.dll");
cplist.ReferencedAssemblies.Add("System.XML.dll");
cplist.ReferencedAssemblies.Add("System.Web.Services.dll");
cplist.ReferencedAssemblies.Add("System.Data.dll");
//编译代理类
CompilerResults cr = icc.CompileAssemblyFromDom(cplist, ccu);
if (true == cr.Errors.HasErrors)
{
System.Text.StringBuilder sb = new StringBuilder();
foreach (CompilerError ce in cr.Errors)
{
sb.Append(ce.ToString());
sb.Append(System.Environment.NewLine);
}
throw new Exception(sb.ToString());
}
//生成代理实例,并调用方法
System.Reflection.Assembly assembly = cr.CompiledAssembly;
Type t = assembly.GetType(@namespace + "." + classname, true, true);
object obj = Activator.CreateInstance(t);
System.Reflection.MethodInfo mi = t.GetMethod(methodname);
return mi.Invoke(obj, args);
}
/// <summary>
///
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
private static string GetClassName(string url)
{
string[] parts = url.Split('/');
string[] pps = parts[parts.Length - 1].Split('.');
return pps[0];
} #endregion
}
}

  测试1

            string url = "http://www.webservicex.net/globalweather.asmx";
string[] args = new string[2];
args[0] = "shenzhen";
args[1] = "China";
object result = WebServiceHelper.InvokeWebService(url, "GetWeather", args);
this.label_Result.Text = result.ToString();

  原结果:

<string xmlns="http://www.webserviceX.NET">
<?xml version="1.0" encoding="utf-16"?> <CurrentWeather> <Location>Shenzhen, China (ZGSZ) 22-33N 114-06E 18M</Location> <Time>Jun 25, 2015 - 10:00 AM EDT / 2015.06.25 1400 UTC</Time> <Wind> from the SSE (150 degrees) at 13 MPH (12 KT):0</Wind> <Visibility> greater than 7 mile(s):0</Visibility> <SkyConditions> mostly clear</SkyConditions> <Temperature> 84 F (29 C)</Temperature> <DewPoint> 78 F (26 C)</DewPoint> <RelativeHumidity> 83%</RelativeHumidity> <Pressure> 29.68 in. Hg (1005 hPa)</Pressure> <Status>Success</Status> </CurrentWeather>
</string>

  

测试2

 try
{
/*
* http://webservice.webxml.com.cn/webservices/DomesticAirline.asmx
getDomesticAirlinesTime
获得航班时刻表 DataSet
输入参数:startCity = 出发城市(中文城市名称或缩写、空则默认:上海);lastCity = 抵达城市(中文城市名称或缩写、空则默认:北京);theDate = 出发日期(String 格式:yyyy-MM-dd,如:2007-07-02,空则默认当天);userID = 商业用户ID(免费用户不需要)
返回数据:DataSet,Table(0)结构为 Item(Company)航空公司、Item(AirlineCode)航班号、Item(StartDrome)出发机场、Item(ArriveDrome)到达机场、Item(StartTime)出发时间、Item(ArriveTime)到达时间、Item(Mode)机型、Item(AirlineStop)经停、Item(Week)飞行周期(星期)
*/
string url = "http://webservice.webxml.com.cn/webservices/DomesticAirline.asmx";
string[] args = new string[4];
args[0] = "上海";
args[1] = "北京";
args[2] = "2015-6-25";//当天时间
args[3] = "";
object result = WebServiceHelper.InvokeWebService(url, "getDomesticAirlinesTime", args);
DataSet dsetAirline = result as DataSet;
this.GridView1.DataSource = dsetAirline.Tables[0];
this.GridView1.DataBind();
Response.Write(dsetAirline.Tables[0].Rows.Count.ToString());
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}

  查询原结果:

<DataSet xmlns="http://WebXml.com.cn/">
<xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="Airlines">
<xs:element name="Airlines" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="AirlinesTime">
<xs:complexType>
<xs:sequence>
<xs:element name="Company" type="xs:string" minOccurs="0"/>
<xs:element name="AirlineCode" type="xs:string" minOccurs="0"/>
<xs:element name="StartDrome" type="xs:string" minOccurs="0"/>
<xs:element name="ArriveDrome" type="xs:string" minOccurs="0"/>
<xs:element name="StartTime" type="xs:string" minOccurs="0"/>
<xs:element name="ArriveTime" type="xs:string" minOccurs="0"/>
<xs:element name="Mode" type="xs:string" minOccurs="0"/>
<xs:element name="AirlineStop" type="xs:string" minOccurs="0"/>
<xs:element name="Week" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<Airlines xmlns="">
<AirlinesTime diffgr:id="AirlinesTime1" msdata:rowOrder="0">
<Company>东方航空</Company>
<AirlineCode>MU5137</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>07:00</StartTime>
<ArriveTime>09:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>12345</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime2" msdata:rowOrder="1">
<Company>南方航空</Company>
<AirlineCode>CZ9916</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>07:00</StartTime>
<ArriveTime>09:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>12345</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime3" msdata:rowOrder="2">
<Company>深圳航空</Company>
<AirlineCode>ZH1858</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>07:55</StartTime>
<ArriveTime>10:10</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>12346</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime4" msdata:rowOrder="3">
<Company>中国国航</Company>
<AirlineCode>CA1858</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>07:55</StartTime>
<ArriveTime>10:10</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>12346</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime5" msdata:rowOrder="4">
<Company>东方航空</Company>
<AirlineCode>MU5101</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>08:00</StartTime>
<ArriveTime>10:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime6" msdata:rowOrder="5">
<Company>南方航空</Company>
<AirlineCode>CZ9889</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>08:00</StartTime>
<ArriveTime>10:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime7" msdata:rowOrder="6">
<Company>海南航空</Company>
<AirlineCode>HU7604</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>08:25</StartTime>
<ArriveTime>10:50</ArriveTime>
<Mode>738</Mode>
<AirlineStop>0</AirlineStop>
<Week>13456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime8" msdata:rowOrder="7">
<Company>东方航空</Company>
<AirlineCode>MU5145</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>08:30</StartTime>
<ArriveTime>10:40</ArriveTime>
<Mode>76A</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime9" msdata:rowOrder="8">
<Company>南方航空</Company>
<AirlineCode>CZ9920</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>08:30</StartTime>
<ArriveTime>10:40</ArriveTime>
<Mode>76A</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime10" msdata:rowOrder="9">
<Company>深圳航空</Company>
<AirlineCode>ZH1590</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>08:55</StartTime>
<ArriveTime>11:15</ArriveTime>
<Mode>330</Mode>
<AirlineStop>0</AirlineStop>
<Week>13456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime11" msdata:rowOrder="10">
<Company>中国国航</Company>
<AirlineCode>CA1590</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>08:55</StartTime>
<ArriveTime>11:15</ArriveTime>
<Mode>330</Mode>
<AirlineStop>0</AirlineStop>
<Week>13456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime12" msdata:rowOrder="11">
<Company>东方航空</Company>
<AirlineCode>MU5103</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>09:00</StartTime>
<ArriveTime>11:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime13" msdata:rowOrder="12">
<Company>南方航空</Company>
<AirlineCode>CZ9890</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>09:00</StartTime>
<ArriveTime>11:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime14" msdata:rowOrder="13">
<Company>东方航空</Company>
<AirlineCode>MU5129</AirlineCode>
<StartDrome>上海浦东国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>09:20</StartTime>
<ArriveTime>11:55</ArriveTime>
<Mode>325</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime15" msdata:rowOrder="14">
<Company>南方航空</Company>
<AirlineCode>CZ9883</AirlineCode>
<StartDrome>上海浦东国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>09:20</StartTime>
<ArriveTime>11:55</ArriveTime>
<Mode>325</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime16" msdata:rowOrder="15">
<Company>东方航空</Company>
<AirlineCode>MU5139</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>09:30</StartTime>
<ArriveTime>11:55</ArriveTime>
<Mode>76A</Mode>
<AirlineStop>0</AirlineStop>
<Week>2346日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime17" msdata:rowOrder="16">
<Company>南方航空</Company>
<AirlineCode>CZ9918</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>09:30</StartTime>
<ArriveTime>11:55</ArriveTime>
<Mode>76A</Mode>
<AirlineStop>0</AirlineStop>
<Week>2346日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime18" msdata:rowOrder="17">
<Company>东方航空</Company>
<AirlineCode>MU5105</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>10:00</StartTime>
<ArriveTime>12:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime19" msdata:rowOrder="18">
<Company>吉祥航空</Company>
<AirlineCode>HO1721</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>10:00</StartTime>
<ArriveTime>12:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime20" msdata:rowOrder="19">
<Company>南方航空</Company>
<AirlineCode>CZ9892</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>10:00</StartTime>
<ArriveTime>12:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime21" msdata:rowOrder="20">
<Company>深圳航空</Company>
<AirlineCode>ZH1832</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>10:55</StartTime>
<ArriveTime>13:15</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>145</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime22" msdata:rowOrder="21">
<Company>中国国航</Company>
<AirlineCode>CA1832</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>10:55</StartTime>
<ArriveTime>13:15</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>145</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime23" msdata:rowOrder="22">
<Company>东方航空</Company>
<AirlineCode>MU5107</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>11:00</StartTime>
<ArriveTime>13:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime24" msdata:rowOrder="23">
<Company>南方航空</Company>
<AirlineCode>CZ9894</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>11:00</StartTime>
<ArriveTime>13:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime25" msdata:rowOrder="24">
<Company>海南航空</Company>
<AirlineCode>HU7606</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>11:25</StartTime>
<ArriveTime>13:45</ArriveTime>
<Mode>738</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime26" msdata:rowOrder="25">
<Company>深圳航空</Company>
<AirlineCode>ZH1836</AirlineCode>
<StartDrome>上海浦东国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>11:30</StartTime>
<ArriveTime>13:55</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>12456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime27" msdata:rowOrder="26">
<Company>中国国航</Company>
<AirlineCode>CA1836</AirlineCode>
<StartDrome>上海浦东国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>11:30</StartTime>
<ArriveTime>13:55</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>12456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime28" msdata:rowOrder="27">
<Company>吉祥航空</Company>
<AirlineCode>HO1902</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>11:55</StartTime>
<ArriveTime>14:15</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>23456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime29" msdata:rowOrder="28">
<Company>深圳航空</Company>
<AirlineCode>ZH1502</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>11:55</StartTime>
<ArriveTime>14:15</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>23456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime30" msdata:rowOrder="29">
<Company>中国国航</Company>
<AirlineCode>CA1502</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>11:55</StartTime>
<ArriveTime>14:15</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>23456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime31" msdata:rowOrder="30">
<Company>东方航空</Company>
<AirlineCode>MU3185</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>12:00</StartTime>
<ArriveTime>14:20</ArriveTime>
<Mode>321</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime32" msdata:rowOrder="31">
<Company>东方航空</Company>
<AirlineCode>MU5109</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>12:00</StartTime>
<ArriveTime>14:25</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime33" msdata:rowOrder="32">
<Company>南方航空</Company>
<AirlineCode>CZ3908</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>12:00</StartTime>
<ArriveTime>14:20</ArriveTime>
<Mode>321</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime34" msdata:rowOrder="33">
<Company>南方航空</Company>
<AirlineCode>CZ9896</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>12:00</StartTime>
<ArriveTime>14:25</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime35" msdata:rowOrder="34">
<Company>厦门航空</Company>
<AirlineCode>MF1764</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>12:00</StartTime>
<ArriveTime>14:20</ArriveTime>
<Mode>321</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime36" msdata:rowOrder="35">
<Company>东方航空</Company>
<AirlineCode>MU564</AirlineCode>
<StartDrome>上海浦东国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>12:20</StartTime>
<ArriveTime>14:45</ArriveTime>
<Mode>321</Mode>
<AirlineStop>0</AirlineStop>
<Week>4</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime37" msdata:rowOrder="36">
<Company>海南航空</Company>
<AirlineCode>HU7608</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>12:35</StartTime>
<ArriveTime>14:55</ArriveTime>
<Mode>738</Mode>
<AirlineStop>0</AirlineStop>
<Week>1345日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime38" msdata:rowOrder="37">
<Company>东方航空</Company>
<AirlineCode>MU5111</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>13:00</StartTime>
<ArriveTime>15:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime39" msdata:rowOrder="38">
<Company>南方航空</Company>
<AirlineCode>CZ9898</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>13:00</StartTime>
<ArriveTime>15:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime40" msdata:rowOrder="39">
<Company>东方航空</Company>
<AirlineCode>MU9103</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>13:30</StartTime>
<ArriveTime>15:55</ArriveTime>
<Mode>75B</Mode>
<AirlineStop>0</AirlineStop>
<Week>4</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime41" msdata:rowOrder="40">
<Company>上海航空</Company>
<AirlineCode>FM9103</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>13:30</StartTime>
<ArriveTime>15:55</ArriveTime>
<Mode>75B</Mode>
<AirlineStop>0</AirlineStop>
<Week>4</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime42" msdata:rowOrder="41">
<Company>东方航空</Company>
<AirlineCode>MU5113</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>14:00</StartTime>
<ArriveTime>16:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime43" msdata:rowOrder="42">
<Company>南方航空</Company>
<AirlineCode>CZ9900</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>14:00</StartTime>
<ArriveTime>16:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime44" msdata:rowOrder="43">
<Company>东方航空</Company>
<AirlineCode>MU272</AirlineCode>
<StartDrome>上海浦东国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>14:10</StartTime>
<ArriveTime>16:40</ArriveTime>
<Mode>321</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime45" msdata:rowOrder="44">
<Company>东方航空</Company>
<AirlineCode>MU5147</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>14:30</StartTime>
<ArriveTime>16:50</ArriveTime>
<Mode>76A</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime46" msdata:rowOrder="45">
<Company>南方航空</Company>
<AirlineCode>CZ9922</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>14:30</StartTime>
<ArriveTime>16:50</ArriveTime>
<Mode>76A</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime47" msdata:rowOrder="46">
<Company>深圳航空</Company>
<AirlineCode>ZH1558</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>14:55</StartTime>
<ArriveTime>17:15</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>2456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime48" msdata:rowOrder="47">
<Company>中国国航</Company>
<AirlineCode>CA1558</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>14:55</StartTime>
<ArriveTime>17:15</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>2456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime49" msdata:rowOrder="48">
<Company>东方航空</Company>
<AirlineCode>MU5115</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>15:00</StartTime>
<ArriveTime>17:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime50" msdata:rowOrder="49">
<Company>南方航空</Company>
<AirlineCode>CZ9902</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>15:00</StartTime>
<ArriveTime>17:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime51" msdata:rowOrder="50">
<Company>东方航空</Company>
<AirlineCode>MU5117</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>16:00</StartTime>
<ArriveTime>18:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime52" msdata:rowOrder="51">
<Company>南方航空</Company>
<AirlineCode>CZ9904</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>16:00</StartTime>
<ArriveTime>18:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime53" msdata:rowOrder="52">
<Company>深圳航空</Company>
<AirlineCode>ZH1884</AirlineCode>
<StartDrome>上海浦东国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>16:15</StartTime>
<ArriveTime>18:40</ArriveTime>
<Mode>330</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime54" msdata:rowOrder="53">
<Company>中国国航</Company>
<AirlineCode>CA1884</AirlineCode>
<StartDrome>上海浦东国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>16:15</StartTime>
<ArriveTime>18:40</ArriveTime>
<Mode>330</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime55" msdata:rowOrder="54">
<Company>吉祥航空</Company>
<AirlineCode>HO1904</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>16:55</StartTime>
<ArriveTime>19:15</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>12345日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime56" msdata:rowOrder="55">
<Company>深圳航空</Company>
<AirlineCode>ZH1518</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>16:55</StartTime>
<ArriveTime>19:15</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>12345日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime57" msdata:rowOrder="56">
<Company>中国国航</Company>
<AirlineCode>CA1518</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>16:55</StartTime>
<ArriveTime>19:15</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>12345日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime58" msdata:rowOrder="57">
<Company>东方航空</Company>
<AirlineCode>MU5119</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>17:00</StartTime>
<ArriveTime>19:25</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime59" msdata:rowOrder="58">
<Company>南方航空</Company>
<AirlineCode>CZ9906</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>17:00</StartTime>
<ArriveTime>19:25</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime60" msdata:rowOrder="59">
<Company>东方航空</Company>
<AirlineCode>MU3929</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>17:20</StartTime>
<ArriveTime>19:35</ArriveTime>
<Mode>321</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime61" msdata:rowOrder="60">
<Company>东方航空</Company>
<AirlineCode>MU3929</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>17:20</StartTime>
<ArriveTime>19:35</ArriveTime>
<Mode>321</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime62" msdata:rowOrder="61">
<Company>吉祥航空</Company>
<AirlineCode>HO1253</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>17:20</StartTime>
<ArriveTime>19:35</ArriveTime>
<Mode>321</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime63" msdata:rowOrder="62">
<Company>吉祥航空</Company>
<AirlineCode>HO1253</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>17:20</StartTime>
<ArriveTime>19:35</ArriveTime>
<Mode>321</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime64" msdata:rowOrder="63">
<Company>东方航空</Company>
<AirlineCode>MU5181</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>17:40</StartTime>
<ArriveTime>19:50</ArriveTime>
<Mode>76A</Mode>
<AirlineStop>0</AirlineStop>
<Week>12345日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime65" msdata:rowOrder="64">
<Company>南方航空</Company>
<AirlineCode>CZ9924</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>17:40</StartTime>
<ArriveTime>19:50</ArriveTime>
<Mode>76A</Mode>
<AirlineStop>0</AirlineStop>
<Week>12345日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime66" msdata:rowOrder="65">
<Company>深圳航空</Company>
<AirlineCode>ZH1522</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>17:55</StartTime>
<ArriveTime>20:20</ArriveTime>
<Mode>773</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime67" msdata:rowOrder="66">
<Company>中国国航</Company>
<AirlineCode>CA1522</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>17:55</StartTime>
<ArriveTime>20:20</ArriveTime>
<Mode>773</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime68" msdata:rowOrder="67">
<Company>东方航空</Company>
<AirlineCode>MU5121</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>18:00</StartTime>
<ArriveTime>20:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime69" msdata:rowOrder="68">
<Company>南方航空</Company>
<AirlineCode>CZ9908</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>18:00</StartTime>
<ArriveTime>20:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime70" msdata:rowOrder="69">
<Company>东方航空</Company>
<AirlineCode>MU3844</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京南苑机场</ArriveDrome>
<StartTime>18:30</StartTime>
<ArriveTime>20:35</ArriveTime>
<Mode>737</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime71" msdata:rowOrder="70">
<Company>中国联航</Company>
<AirlineCode>KN5956</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京南苑机场</ArriveDrome>
<StartTime>18:30</StartTime>
<ArriveTime>20:35</ArriveTime>
<Mode>737</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime72" msdata:rowOrder="71">
<Company>深圳航空</Company>
<AirlineCode>ZH1516</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>18:55</StartTime>
<ArriveTime>21:20</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>12345日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime73" msdata:rowOrder="72">
<Company>中国国航</Company>
<AirlineCode>CA1516</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>18:55</StartTime>
<ArriveTime>21:20</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>12345日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime74" msdata:rowOrder="73">
<Company>东方航空</Company>
<AirlineCode>MU5123</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>19:00</StartTime>
<ArriveTime>21:25</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime75" msdata:rowOrder="74">
<Company>南方航空</Company>
<AirlineCode>CZ9910</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>19:00</StartTime>
<ArriveTime>21:25</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime76" msdata:rowOrder="75">
<Company>深圳航空</Company>
<AirlineCode>ZH1550</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>19:55</StartTime>
<ArriveTime>22:15</ArriveTime>
<Mode>773</Mode>
<AirlineStop>0</AirlineStop>
<Week>145日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime77" msdata:rowOrder="76">
<Company>中国国航</Company>
<AirlineCode>CA1550</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>19:55</StartTime>
<ArriveTime>22:15</ArriveTime>
<Mode>773</Mode>
<AirlineStop>0</AirlineStop>
<Week>145日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime78" msdata:rowOrder="77">
<Company>东方航空</Company>
<AirlineCode>MU5125</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>20:00</StartTime>
<ArriveTime>22:25</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime79" msdata:rowOrder="78">
<Company>南方航空</Company>
<AirlineCode>CZ9912</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>20:00</StartTime>
<ArriveTime>22:25</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime80" msdata:rowOrder="79">
<Company>东方航空</Company>
<AirlineCode>MU5199</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>20:30</StartTime>
<ArriveTime>23:00</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime81" msdata:rowOrder="80">
<Company>南方航空</Company>
<AirlineCode>CZ9926</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>20:30</StartTime>
<ArriveTime>23:00</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime82" msdata:rowOrder="81">
<Company>海南航空</Company>
<AirlineCode>HU7602</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>20:40</StartTime>
<ArriveTime>23:10</ArriveTime>
<Mode>738</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime83" msdata:rowOrder="82">
<Company>深圳航空</Company>
<AirlineCode>ZH1856</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>20:55</StartTime>
<ArriveTime>23:15</ArriveTime>
<Mode>330</Mode>
<AirlineStop>0</AirlineStop>
<Week>1246</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime84" msdata:rowOrder="83">
<Company>深圳航空</Company>
<AirlineCode>ZH4912</AirlineCode>
<StartDrome>上海浦东国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>20:55</StartTime>
<ArriveTime>23:05</ArriveTime>
<Mode>330</Mode>
<AirlineStop>0</AirlineStop>
<Week>2456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime85" msdata:rowOrder="84">
<Company>中国国航</Company>
<AirlineCode>CA178</AirlineCode>
<StartDrome>上海浦东国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>20:55</StartTime>
<ArriveTime>23:05</ArriveTime>
<Mode>330</Mode>
<AirlineStop>0</AirlineStop>
<Week>2456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime86" msdata:rowOrder="85">
<Company>中国国航</Company>
<AirlineCode>CA1856</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>20:55</StartTime>
<ArriveTime>23:15</ArriveTime>
<Mode>330</Mode>
<AirlineStop>0</AirlineStop>
<Week>1246</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime87" msdata:rowOrder="86">
<Company>东方航空</Company>
<AirlineCode>MU5127</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>21:00</StartTime>
<ArriveTime>23:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>345日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime88" msdata:rowOrder="87">
<Company>南方航空</Company>
<AirlineCode>CZ9914</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>21:00</StartTime>
<ArriveTime>23:20</ArriveTime>
<Mode>333</Mode>
<AirlineStop>0</AirlineStop>
<Week>12345</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime89" msdata:rowOrder="88">
<Company>东方航空</Company>
<AirlineCode>MU5186</AirlineCode>
<StartDrome>上海浦东国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>21:10</StartTime>
<ArriveTime>23:40</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>246日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime90" msdata:rowOrder="89">
<Company>南方航空</Company>
<AirlineCode>CZ9886</AirlineCode>
<StartDrome>上海浦东国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>21:10</StartTime>
<ArriveTime>23:40</ArriveTime>
<Mode>JET</Mode>
<AirlineStop>0</AirlineStop>
<Week>246日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime91" msdata:rowOrder="90">
<Company>东方航空</Company>
<AirlineCode>MU9107</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>21:30</StartTime>
<ArriveTime>23:45</ArriveTime>
<Mode>738</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime92" msdata:rowOrder="91">
<Company>上海航空</Company>
<AirlineCode>FM9107</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>21:30</StartTime>
<ArriveTime>23:45</ArriveTime>
<Mode>738</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime93" msdata:rowOrder="92">
<Company>东方航空</Company>
<AirlineCode>MU3927</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>21:50</StartTime>
<ArriveTime>00:20</ArriveTime>
<Mode>320</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime94" msdata:rowOrder="93">
<Company>吉祥航空</Company>
<AirlineCode>HO1251</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>21:50</StartTime>
<ArriveTime>00:20</ArriveTime>
<Mode>320</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime95" msdata:rowOrder="94">
<Company>中国国航</Company>
<AirlineCode>CA5902</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>21:50</StartTime>
<ArriveTime>00:20</ArriveTime>
<Mode>320</Mode>
<AirlineStop>0</AirlineStop>
<Week>123456日</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime96" msdata:rowOrder="95">
<Company>深圳航空</Company>
<AirlineCode>ZH1886</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>21:55</StartTime>
<ArriveTime>00:20</ArriveTime>
<Mode>330</Mode>
<AirlineStop>0</AirlineStop>
<Week>1234</Week>
</AirlinesTime>
<AirlinesTime diffgr:id="AirlinesTime97" msdata:rowOrder="96">
<Company>中国国航</Company>
<AirlineCode>CA1886</AirlineCode>
<StartDrome>上海虹桥国际机场</StartDrome>
<ArriveDrome>北京首都国际机场</ArriveDrome>
<StartTime>21:55</StartTime>
<ArriveTime>00:20</ArriveTime>
<Mode>330</Mode>
<AirlineStop>0</AirlineStop>
<Week>1234</Week>
</AirlinesTime>
</Airlines>
</diffgr:diffgram>
</DataSet>

  创建demo.asmx 如下:

/// <summary>
/// demo 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
// [System.Web.Script.Services.ScriptService]
public class demo : System.Web.Services.WebService
{ // WEB 服务示例
// HelloWorld() 示例服务返回字符串 Hello World
// 若要生成,请取消注释下列行,然后保存并生成项目
// 若要测试此 Web 服务,请按 F5 键
/// <summary>
/// 字符串型
/// </summary>
/// <returns>Hello World</returns>
[WebMethod(Description = "字符串型")]
public string HelloWorld()
{
return "Hello World";
}
/// <summary>
/// 整型
/// </summary>
/// <returns>Int</returns>
[WebMethod(Description = "整型")]
public int GetInt()
{
return 1234;
} /// <summary>
/// 布尔型
/// </summary>
/// <returns>Bool</returns>
[WebMethod(Description = "布尔型")]
public bool GetBool()
{
return true;
}
/// <summary>
/// 返回实体类
/// 必须是已序列化的类
/// </summary>
/// <returns>学生类</returns>
[WebMethod(Description = "学生类")]
public Student GetStudent()
{
Student stu = new Student();
stu.Name = "张三";
stu.Age = 25;
stu.Sex = true;
return stu;
}
/// <summary>
/// 返回DataSet数据类型
/// </summary>
/// <returns>DataSet</returns>
[WebMethod(Description = "DataSet.")]
public DataSet GetDataSet()
{
DataSet ds = new DataSet();
return ds;
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
[WebMethod(Description = "输入字符串 ,返回DataSet数据类型")]
public DataSet GetDataTable(string key)
{
DataSet rd = new DataSet();
try
{
DataTable dt = new DataTable();
dt.Columns.Add("id", typeof(int));
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("code", typeof(string));
dt.Rows.Add(1, "geovindu", "0091");
dt.Rows.Add(2, "du", "0094");
dt.Rows.Add(3, "geovin", "0095");
dt.Rows.Add(4, "sibodu", "0093");
dt.Rows.Add(5, "ginhongzhao", "du");
//var query = from p in dt.AsEnumerable()
// where p.Field<string>("code") == key
// select new
// {
// name = p.Field<string>("name"),
// age = p.Field<int>("age")
// };
IEnumerable<DataRow> query1 = from contact in dt.AsEnumerable()
where contact.Field<string>("name") == key
select contact; IEnumerable<DataRow> query2 = from contact in dt.AsEnumerable()
where contact.Field<string>("code") == key
select contact; IEnumerable<DataRow> query3 = dt.Select("name ='"+key+"' or code = '"+key+"'"); DataTable contacts1;
DataTable contacts2;
DataTable contacts3; if (query1.Count() > 0)
{
contacts1 = query1.CopyToDataTable();
rd = SplitRows(contacts1);
}
if (query2.Count()>0)
{
contacts2 = query2.CopyToDataTable();
rd.Tables.Add(contacts2);
} if (query3.Count() > 0)
{
contacts3 = query3.CopyToDataTable();
rd.Tables.Add(contacts3);
} }
catch (Exception ex)
{
ex.Message.ToString();
}
return rd;
}
/// <summary>
///
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
private DataSet SplitRows(DataTable source)
{ DataSet ds = new DataSet(); foreach (DataRow r in source.Rows)
{
DataTable copy = source.Clone();
copy.LoadDataRow(r.ItemArray, true);
ds.Tables.Add(copy);
} return ds; } }
#region 定义可序列化类
/*
* 为避免Framework1.1中返回实体类报错“请求格式无法识别。”
* 要在Web.Config文件中<system.web>添加以下内容:
* <webServices>
<protocols>
<add name="HttpPost" />
<add name="HttpGet" />
</protocols>
</webServices>
*/
//指示下面的类可序列化
/// <summary>
/// 学生基本信息类
/// </summary>
[Serializable]
public class Student
{
/// <summary>
/// 构造函数
/// </summary>
public Student()
{
}
private string name;
/// <summary>
/// 姓名
/// </summary>
public string Name
{
get
{
return name;
}
set
{
name=value;
}
}
private bool sex;
/// <summary>
/// 性别--布尔型变量真为女,假为男
/// </summary>
public bool Sex
{
get
{
return sex;
}
set
{
sex=value;
}
}
private int age;
/// <summary>
/// 年龄
/// </summary>
public int Age
{
get
{
return age;
}
set
{
age=value;
}
}
}
#endregion

  测试:

                //http://localhost:25608/demo.asmx
string url = "http://localhost:25608/demo.asmx";
object[] args = new object[1];
args[0]="du";
object result = WSHelper.InvokeWebService(url, "GetDataTable", args);
DataSet ds = (DataSet)result;
this.GridView1.DataSource = ds.Tables[2];
this.GridView1.DataBind();
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());

  

 /// <summary>
/// 取得所有Method Name
/// </summary>
public class MethodInfo
{
/// <summary>
/// 主method 名稱
/// </summary>
public string MethodName { get; set; } /// <summary>
/// 在WSDL 中 InputMessage的名稱 通常為 [MethodName]SoapIn
/// </summary>
public string InputMessageName { get; set; } /// <summary>
/// 在WSDL 中 OutputMessage的名稱 通常為 [MethodName]SoapOut
/// </summary>
public string OutputMessageName { get; set; } /// <summary>
/// 輸入的參數們 Key名稱 , Value為型別
/// </summary>
public Dictionary<string,string> InputParameters { get; set; } /// <summary>
/// 輸出的參數們 Key名稱 , Value為型別
/// </summary>
public Dictionary<string, string> OutParameters { get; set; }
public string Desc { get; set; } public MethodInfo()
{
InputParameters=new Dictionary<string, string>();
OutParameters=new Dictionary<string, string>();
} /// <summary>
/// 透過網址取得資料後 並且讀為 GeServiceDescriptionFromServicePath
/// </summary>
/// <param name="servicePath"></param>
/// <returns></returns>
private ServiceDescription GeServiceDescriptionFromServicePath(string servicePath)
{
if (!servicePath.ToLower().Contains("?wsdl"))
{
servicePath = servicePath + "?wsdl";
} var wc = new WebClient();
wc.Encoding = UTF8Encoding.UTF8;
byte[] byteArray = Encoding.UTF8.GetBytes(wc.DownloadString(servicePath));
var stream = new MemoryStream(byteArray);
return ServiceDescription.Read(stream);
} /// <summary>
/// 取得 Parameters
/// </summary>
/// <param name="serviceDescription"></param>
/// <param name="messagePartName"></param>
/// <returns></returns>
private static Dictionary<string, string> GetParameters(ServiceDescription serviceDescription, string messagePartName)
{
var types = serviceDescription.Types;
var xmlSchema = types.Schemas[0];
return (from schemaElement in xmlSchema.Items.OfType<XmlSchemaElement>() where schemaElement.Name == messagePartName select schemaElement.SchemaType).OfType<XmlSchemaComplexType>().Select(complexType => complexType.Particle).OfType<XmlSchemaSequence>().SelectMany(sequence => sequence.Items.Cast<XmlSchemaElement>()).ToDictionary(childElement => childElement.Name, childElement => childElement.SchemaTypeName.Name);
} /// <summary>
/// 取得所有的Method Details
/// </summary>
/// <param name="serviceDescription"></param>
/// <returns></returns>
public MethodInfo[] GetMethodInfos(ServiceDescription serviceDescription)
{
var res = new List<MethodInfo>(); foreach (PortType portType in serviceDescription.PortTypes)
{
foreach (Operation operation in portType.Operations)
{ var me = new MethodInfo();
me.MethodName = operation.Name;
me.InputMessageName = operation.Messages.Input.Message.Name;
me.OutputMessageName = operation.Messages.Output.Message.Name; //注1
me.InputParameters = GetParameters(serviceDescription, serviceDescription.Messages[me.InputMessageName].Parts[0].Element.Name);
me.OutParameters = GetParameters(serviceDescription, serviceDescription.Messages[me.OutputMessageName].Parts[0].Element.Name); if (operation.DocumentationElement != null)
me.Desc = operation.DocumentationElement.InnerText; res.Add(me);
}
} return res.ToArray();
} }

  测试:

 txtWebServicePath.Text = "http://webservice.webxml.com.cn/webservices/DomesticAirline.asmx";
var serviceDesc = GeServiceDescriptionFromServicePath(txtWebServicePath.Text);
//取得所有Method Name .
var allMethodNames = GetAllMethodsName(serviceDesc).Distinct();
ltlResult.Text = "";
ltlResult.Text += "<ul>";
foreach (var s in allMethodNames)
{
ltlResult.Text += "<li>" + s + "</li>";
}
ltlResult.Text += "</ul>";

  

    /// <summary>
///
/// </summary>
public class WSHelper
{
/// < summary>
/// 动态调用web服务
/// < /summary>
/// < param name="url">WSDL服务地址< /param>
/// < param name="methodname">方法名< /param>
/// < param name="args">参数< /param>
/// < returns>< /returns>
public static object InvokeWebService(string url, string methodname, object[] args)
{
return WSHelper.InvokeWebService(url, null, methodname, args);
}
/// < summary>
/// 动态调用web服务
/// < /summary>
/// < param name="url">WSDL服务地址< /param>
/// < param name="classname">类名< /param>
/// < param name="methodname">方法名< /param>
/// < param name="args">参数< /param>
/// < returns>< /returns>
public static object InvokeWebService(string url, string classname, string methodname, object[] args)
{
string @namespace = "EnterpriseServerBase.WebService.DynamicWebCalling";
if ((classname == null) || (classname == ""))
{
classname = WSHelper.GetWsClassName(url);
}
try
{ //获取WSDL
WebClient wc = new WebClient();
Stream stream = wc.OpenRead(url + "?WSDL");
ServiceDescription sd = ServiceDescription.Read(stream);
ServiceDescriptionImporter sdi = new ServiceDescriptionImporter();
sdi.AddServiceDescription(sd, "", "");
CodeNamespace cn = new CodeNamespace(@namespace);
//生成客户端代理类代码
CodeCompileUnit ccu = new CodeCompileUnit();
ccu.Namespaces.Add(cn);
sdi.Import(cn, ccu);
CSharpCodeProvider icc = new CSharpCodeProvider();
//设定编译参数
CompilerParameters cplist = new CompilerParameters();
cplist.GenerateExecutable = false;
cplist.GenerateInMemory = true;
cplist.ReferencedAssemblies.Add("System.dll");
cplist.ReferencedAssemblies.Add("System.XML.dll");
cplist.ReferencedAssemblies.Add("System.Web.Services.dll");
cplist.ReferencedAssemblies.Add("System.Data.dll");
//编译代理类
CompilerResults cr = icc.CompileAssemblyFromDom(cplist, ccu);
if (true == cr.Errors.HasErrors)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (System.CodeDom.Compiler.CompilerError ce in cr.Errors)
{
sb.Append(ce.ToString());
sb.Append(System.Environment.NewLine);
}
throw new Exception(sb.ToString());
}
//生成代理实例,并调用方法
System.Reflection.Assembly assembly = cr.CompiledAssembly;
Type t = assembly.GetType(@namespace + "." + classname, true, true);
object obj = Activator.CreateInstance(t);
System.Reflection.MethodInfo mi = t.GetMethod(methodname);
return mi.Invoke(obj, args);
// PropertyInfo propertyInfo = type.GetProperty(propertyname);
//return propertyInfo.GetValue(obj, null);
}
catch (Exception ex)
{
throw new Exception(ex.InnerException.Message, new Exception(ex.InnerException.StackTrace));
}
}
/// <summary>
///
/// </summary>
/// <param name="wsUrl"></param>
/// <returns></returns>
private static string GetWsClassName(string wsUrl)
{
string[] parts = wsUrl.Split('/');
string[] pps = parts[parts.Length - 1].Split('.');
return pps[0];
} }

 

Windows Presentation Foundation

Windows Workflow Foundation

Windows Communication Foundation

Windows Cardspace

 

csharp: get Web.Services WebMethod的更多相关文章

  1. 分分钟带你玩转 Web Services

    当大型需求被数个公司分割开来,各公司系统相互交换数据的问题就会接踵而来. 毕竟是多家不同的公司的产品,研发开发语言.采用技术框架基本上是百花齐放. 怎样让自家系统提供的服务具有跨平台.跨语言.跨各种防 ...

  2. 【整理】动态加载Web Services

    WebClient client = new WebClient(); String url = "http://localhost/MESAPIWebService/MESAPI.asmx ...

  3. asp.net Ajax和web services

    新建一个web服务 using System; using System.Collections.Generic; using System.Linq; using System.Web; using ...

  4. Web Services 中XML、SOAP和WSDL的一些必要知识

    Web Services 是由xml来定义数据格式的,通过SOAP协议在各个系统平台中传输,那么接下来讨论下SOAP和WSDL的各自作用. SOAP和WSDL对Web Service.WCF进行深入了 ...

  5. 跟我一起学WCF(3)——利用Web Services开发分布式应用

    一.引言 在前面文章中分别介绍了MSMQ和.NET Remoting技术,今天继续分享.NET 平台下另一种分布式技术——Web Services 二.Web Services 详细介绍 2.1 We ...

  6. Java与.NET 的Web Services相互调用

    一:简介 本文介绍了Java与.NET开发的Web Services相互调用的技术.本文包括两个部分,第一部分介绍了如何用.NET做客户端调用Java写的Web Services,第二部分介绍了如何用 ...

  7. [转]Web Services使用out参数

    本文转自:http://www.cnblogs.com/zhaozhan/archive/2010/10/25/1860837.html Web Services使用out参数,在SOAP协议中会跟返 ...

  8. Web Services and C# Enums -摘自网络

    Web Service Transparency .NET support for web services is excellent in creating illusion of transpar ...

  9. PHP 调用asp.net Web Services服务问题总结

    原文:PHP 调用asp.net Web Services服务问题总结 PHP是弱类型语言,转换非常不方便. < ?php //soap 客户端 $client=new SoapClient(' ...

随机推荐

  1. Gradle 笔记

    网上有一篇文章说的很明白,图文来教你在eclipse下用gradle 来打包Androidhttp://blog.csdn.net/x605940745/article/details/4124268 ...

  2. iis,w3wp一直出现WerFault.exe应用程序错误

    这个进程是Windows错误报告技术里的一个东西,来收集软件崩溃或者挂起后的数据然后向微软反馈报告.关闭系统的错误报告功能后看看 1:打开 运行 (热键:win+R)输入 gpedit.msc 打开  ...

  3. python-推荐

    users={"Angelica": {"Blues Traveler": 3.5, "Broken Bells": 2.0, " ...

  4. css3实现进度条的模拟

    两种进度条动画的实现: 1.css3,但IE9-不支持. 2.js动画,兼容性好,但没有css3实现的顺畅 Demo: <html>    <head>        < ...

  5. Python--将内容写入文本文件中

    #-*- coding: utf-8 -*- import sys __cfg__version__ = 'debug' # release if __name__ == '__main__': pr ...

  6. MSSQL获得表的字段名称及其参数

    SELECT ColumnsName = c.name, [Description] = ex.value, ColumnType = t.name, [Length]=c.max_length FR ...

  7. python-redis 入门

    redis官网http://redis.io Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API. Redis是一 ...

  8. struts2完全捕获404错误的方法

    目前在做一个网络应用程序,struts2 + spring + hibernate,服务器是tomcat.希望用户在IE地址栏乱敲的时候,所敲入的所有未定义的URL都能被程序捕捉到,然后转到一个自制的 ...

  9. KIS旗舰版常用数据表

    select * from IC_Web2ERPOrders  --网上订单  FOrderStatus 14--已发货,6--待发货,2--待配货,1--未审核 (审核后变为2,进入待配货)sele ...

  10. AssetBundle系列——场景资源之打包(一)

    本篇讲解的是3D游戏的场景资源打包方式,首先简单的分析一下场景中所包含的资源的类型. 场景资源一般包含:地表模型(或者是Unity Terrain),非实例化物体(摄像机.空气墙.光源.各种逻辑物体之 ...