新微赢技术网
标题:
WebService XML数据处理
[打印本页]
作者:
我和老公在
时间:
2009-12-1 23:46
标题:
WebService XML数据处理
WebService接口 XML数据处理
[WebMethod(Description = "机票用户注册")]
public string AirtripInsertUser(string identity, string request, string filter)
{
if (request != "")
{
try
{
TextReader stringReader = new StringReader(request);
DataSet ds = new DataSet();
ds.ReadXml(stringReader);
DataRow dr = ds.Tables[0].Rows[0];
if (ds.DataSetName.StartsWith("InsertUserInfo"))
{
string AirtripXML = "";
string xmlFilename = Server.MapPath("../WebXml/request_1_0.xml");
DataSet airtripDataSet = new DataSet();
airtripDataSet.ReadXml(xmlFilename);
DataRow airtrip_DR = airtripDataSet.Tables[0].Rows[0];
//return airtripDataSet.GetXml();
if (airtrip_DR.ItemArray.GetLength(0) == dr.ItemArray.GetLength(0))
{
for (int index = 0; index <= airtrip_DR.ItemArray.Length - 1; index++)
{
airtrip_DR[index] = dr[index].ToString();
}
AirtripXML = airtripDataSet.GetXml();
//airtripDataSet.WriteXml(xmlFilename);
//return "测试成功";
www_airtrip_net_cn.Service airtrip = new www_airtrip_net_cn.Service();
return airtrip.XmlSubmit(identity, AirtripXML, filter);
}
else
{
return "数据异常!";
}
}
else
{
return "开始标记与结束标记不匹配!";
}
}
catch (System.Exception e)
{
return e.Message.ToString();
}
}
else
{
return "缺少重要数据!";
}
}
[WebMethod(Description = "机票用户信息更新")]
public string AirtripUpdateUser(string identity, string request, string filter)
{
if (request != "")
{
try
{
TextReader stringReader = new StringReader(request);
DataSet ds = new DataSet();
ds.ReadXml(stringReader);
DataRow dr = ds.Tables[0].Rows[0];
if (ds.DataSetName.StartsWith("UpdateUserInfo"))
{
string AirtripXML = "";
string xmlFilename = Server.MapPath("../WebXml/request_1_0.xml");
DataSet airtripDataSet = new DataSet();
airtripDataSet.ReadXml(xmlFilename);
DataRow airtrip_DR = airtripDataSet.Tables[0].Rows[0];
//return airtripDataSet.GetXml();
if (airtrip_DR.ItemArray.GetLength(0) == dr.ItemArray.GetLength(0))
{
for (int index = 0; index <= airtrip_DR.ItemArray.Length - 1; index++)
{
airtrip_DR[index] = dr[index].ToString();
}
AirtripXML = airtripDataSet.GetXml();
AirtripXML = AirtripXML.Replace("InsertUserInfo", "UpdateUserInfo");
//airtripDataSet.WriteXml(xmlFilename);
//return "测试成功";
www_airtrip_net_cn.Service airtrip = new www_airtrip_net_cn.Service();
return airtrip.XmlSubmit(identity, AirtripXML, filter);
}
else
{
return "数据异常!";
}
}
else
{
return "开始标记与结束标记不匹配!";
}
}
catch (System.Exception e)
{
return e.Message.ToString();
}
}
else
{
return "缺少重要数据!";
}
}
欢迎光临 新微赢技术网 (http://bbs.weiying.cn/)
Powered by Discuz! X3.2